# Cannot properly define an rgb color

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

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

I tried to define this color using the following code

\documentclass{standalone}

\usepackage{tikz}

\begin{document}
\definecolor{tank}{rgb}{0.098,0.190,0.177}
%\definecolor{tank}{rgb}{98,190,177}
\begin{tikzpicture}
\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;
\end{tikzpicture}
\end{document}


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

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?

-
You want \definecolor{tank}{RGB}{98,190,177}, note the uppercase. –  egreg Aug 30 at 11:15
or rgb, but with proper scaling of your values, dividing by 255, rather than 1000 as you did in your MWE. –  greyshade Aug 30 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 at 11:18
@greyshade : Thank you very much! I didn't know about that either! Why 255? –  Thanos Aug 30 at 11:19
@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 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.

\documentclass{article}
\usepackage{xcolor}

\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)

\begin{document}
\newcommand*{\test}[1]{%
\textcolor{#1}{\rule{10mm}{10mm}}%
}
\test{A}
\test{B}
\test{C}
\test{D}
\end{document}


-

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:

\definecolor{tank}{RGB}{98,190,177}
\definecolor{tank}{rgb}{0.3843,0.7451,0.6941}


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.

-