I am trying to define an rgb color. More specifically I want to create this color

enter image description here

which in rgb mode it's (98,190,177).

I tried to define this color using the following code



  \coordinate (tank) at (0,0);
  \draw[red, fill=tank] (-2,0.5)--(-0.5,1)--(0.5,1)--(2,0.5)--(2,-0.5)--(0.5,-1)--(-0.5,-1)--(-2,-0.5)--cycle;

but the output is totally different from what I am trying to achieve

enter image description here

I also tried to use \definecolor{tank}{rgb}{98,190,177} but I get no color at all. How to properly define an rgb color?

  • 3
    You want \definecolor{tank}{RGB}{98,190,177}, note the uppercase. – egreg Aug 30 '14 at 11:15
  • 2
    or rgb, but with proper scaling of your values, dividing by 255, rather than 1000 as you did in your MWE. – greyshade Aug 30 '14 at 11:18
  • @egreg: Wow!!! Thank you very much! I didn't know about that!Would you mind posting an answer? Thank's again! – Thanos Aug 30 '14 at 11:18
  • @greyshade : Thank you very much! I didn't know about that either! Why 255? – Thanos Aug 30 '14 at 11:19
  • 1
    @Thanos see my answer - 255 is the maximum representable by one byte which is what RGB allocates to represent each base colour's value. – greyshade Aug 30 '14 at 11:26

The colors in the screenshot are specified as

  • HSV: (172, 48, 75) ∈ [0..360] × [0..100]2
  • RGB: (98, 190, 177) ∈ [0..255]3 (three bytes)
  • HTML: 0x62beb1 ∈ [0x0..0xFFFFFF] (three bytes also RGB values)

Package xcolor supports RGB and HTML directly and HSV is indirectly supported via Hsb, where the saturation and brightness are given in range [0..1].

Package color only supports the basic color models such as rgb:

  • rgb: (98/255, 190/255, 177/255) ∈ [0..1]3 (three bytes)

Because of the different range, the values needs to be calculated first.


\definecolor{A}{Hsb}{172,.48,.75}% xcolor
\definecolor{B}{RGB}{98,190,177}% xcolor
\definecolor{C}{HTML}{62BEB1}% xcolor
\definecolor{D}{rgb}{.3843,.7451,.6941}% color, xcolor
% (r, g, b) = (R/255, G/255, B/255)




In RGB mode colours are defined by one byte for each of the colours red, green and blue - hence RGB. The maximum mavlue representable by a byte (i.e. eight bit) is 2^8 - 1 = 255.

Specifying RGB colours may be done in two ways:


where the first (with uppercase RGB in the definition) specifies the value of the colour byte, while the second (with lowercase rgb) specifies a percentage - i.e. the value used in the first divided by the maximum value 255.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.