[Tex/LaTex] Cannot properly define an rgb color

color

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

\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

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?

Best Answer

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}

Result