LaTeX-color&xcolor宏包的使用

\documentclass{article}
\usepackage{xeCJK}
\usepackage{mathpazo}
\usepackage{color,xcolor}
% predefined color---black, blue, brown, cyan, darkgray, gray, green, lightgray, lime, magenta, olive, orange, pink, purple, red, teal, violet, white, yellow.

\definecolor{light-gray}{gray}{0.95}    % 1.灰度
\definecolor{orange}{rgb}{1,0.5,0}      % 2.rgb
\definecolor{orange}{RGB}{255,127,0}    % 3.RGB
\definecolor{orange}{HTML}{FF7F00}      % 4.HTML
\definecolor{orange}{cmyk}{0,0.5,1,0}   % 5.cmyk

\begin{document}
%\pagecolor{yellow}          %设置背景色为黄色
\textcolor{green}{绿色}     %1.方法一
{\color{orange} 橙色}       %2.方法二

\colorbox{red}{\color{black}红底黑字}
\fcolorbox{red}{green}{红框绿背景} %框色+背景色

\color{blue!20}
\color{blue!20!black}
\color{blue!20!black!30!green}  %a mixture of (20*0.3) percent blue, ((100-20)*0.3) percent black and (100-30) percent green

{\color[rgb]{1,0,0} This text will appear red-colored}          % 直接使用
\textcolor[rgb]{0,1,0}{This text will appear green-colored}     % 直接使用

\end{document} 

推荐阅读更多精彩内容