How to set font color in Latex (3 ways)

1. Use the defined color directly
\usepackage{color}

\textcolor{red/blue/green/black/white/cyan/magenta/yellow}{text}

where textcolor{…} contains the system-defined colors

 

2. Combine the values of red, green and blue to form the color we want
\usepackage{color}

\textcolor[rgb]{r,g,b}{text}

where {r,g,b} represents the combination of red, green and blue colors, and takes values in the range [0-1]

\textcolor[RGB]{R,G,B}{text}

where {R,G,B} represents the combination of red, green and blue colors, and the range of values is [0-255]

 

3. Define a color, call directly
\usepackage{color}

\definecolor{ColorName}{rgb}{r,g,b} This time r/g/b is defined in the range [0-1].

\definecolor{ColorName}{RGB}{R,G,B}, when the domain of R/G/B is defined in [0-255].

Here the name ColorName is defined for the color, and the following can call this color scheme directly

\textcolor{ColorName}{text}

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *