用于设置未命名 RGB 颜色的命令?

用于设置未命名 RGB 颜色的命令?

是否有任何命令可以设置“输出”颜色并提供其 RGB 值,即无需先定义颜色名称?

答案1

\documentclass{article}
\usepackage{color}
\begin{document}

\color[rgb]{1,0,0} red

\end{document}

答案2

评论不接受代码所以我把它写在这里(注意这只是一条评论,答案当然是可以的)

\documentclass{article}
\usepackage{color}
\begin{document}
\textcolor[rgb]{1,0,0} {red}

The line below will give :
! Package color Error: Argument `62' not in range [0,1].See the color package documentation for explanation.Type H <return> for immediate help.... 
%
\begin{verbatim}
\textcolor[rgb]{62,114,196} {Medium Blue} 
\end{verbatim}
Using a color picker, rgb is usually given in integer between 0 and 255 so you have to use RGB *upper case*:
\begin{verbatim}
\textcolor[RGB]{62,114,196} {Medium Blue}
\end{verbatim}
\textcolor[RGB]{62,114,196} {Medium Blue} 
\end{document}

相关内容