[Tex/LaTex] Using RGB or HTML color model in Tikz nodes

colortikz-nodetikz-pgf

In PGF manual almost in all examples red!50!white this type of syntax is used, however I find it very difficult to write it in this syntax to get desired color. Tikz uses xcolor package for coloring and xcolor has RGB,HTML and many other color models,but it does not mention anything about the syntax of using those color models in Tikz.

Is there any way to use these modes in Tikz and it will be very helpful if I can also use transparency parameter like alpha in RGB and opacity in HTML.

Here is the minimal example you can modify

\draw (3in,-3in) node [draw,fill=red!50!white,shape=trapezium,trapezium left angle=40,trapezium right angle=-40,minimum height=1in,minimum width=1in,trapezium stretches=true,text width=0.58in,align=center] {Lorem Ipsum};

Best Answer

If you explicitly load xcolor with the [rgb] option (BEFORE loading tikz), all colors defined in whatever color spaces are converted to rgb. The following MWE demonstrates this. This allows you to use virtually any color space supported by xcolor. Handy.

\documentclass{article}

\usepackage[rgb]{xcolor}
\usepackage{tikz}

\usetikzlibrary{shapes}

\definecolor{yucky}{HTML}{808000}
\definecolor{blueish}{RGB}{125,100,255}

\begin{document}

\tikz \draw (3in,-3in) node [draw,fill=blueish,shape=trapezium,trapezium left angle=40,trapezium right angle=-40,minimum height=1in,minimum width=1in,trapezium stretches=true,text width=0.58in,align=center] {Lorem Ipsum};

\tikz \draw (3in,-3in) node [draw,fill=yucky,shape=trapezium,trapezium left angle=40,trapezium right angle=-40,minimum height=1in,minimum width=1in,trapezium stretches=true,text width=0.58in,align=center] {Lorem Ipsum};

\end{document}

As for transparency you can find numerous pointers as indicated by @Phelype Oleinik for example.