有没有 LaTex 风格的方法来获取互补色?
例如xcolor
包中对应的命令?
\documentclass[]{book}
\usepackage{xcolor}
\definecolor{Acolor}{named}{red}
\definecolor{Bcolor}{named}{yellow}
\begin{document}
\colorbox{Acolor}{text} $\leftrightarrow$ \colorbox{gray}{complementary color here}
\colorbox{Bcolor}{text} $\leftrightarrow$ \colorbox{gray}{complementary color here}
\end{document}
答案1
定义“互补色”并不容易;-)(这取决于模型,你应该看看第 6.3 节xcolor
手动的),但在紧急情况下,您可以使用如下语法-color
(同一手册第 4 页):
因此,你的例子:
\documentclass[]{book}
\usepackage{xcolor}
\definecolor{Acolor}{named}{red}
\definecolor{Bcolor}{named}{yellow}
\begin{document}
\colorbox{Acolor}{text} $\leftrightarrow$ \colorbox{-Acolor}{complementary color here}
\colorbox{Bcolor}{text} $\leftrightarrow$ \colorbox{-Bcolor}{complementary color here}
\end{document}
...只是为了好玩:
\documentclass[]{book}
\usepackage{xcolor}
\definecolor{Acolor}{named}{red}
\definecolor{Bcolor}{named}{yellow}
\definecolor{yellowrgb}{rgb}{1,1,0}
\definecolor{yellowcmyk}{cmyk}{0,0,1,0}
\definecolor{yellowHsb}{Hsb}{60,1,1}
\begin{document}
\colorbox{Acolor}{text} $\leftrightarrow$ \colorbox{-Acolor}{complementary color here}
\colorbox{Bcolor}{text} $\leftrightarrow$ \colorbox{-Bcolor}{complementary color here}
\colorbox{yellowrgb}{text} $\leftrightarrow$ \colorbox{-yellowrgb}{complementary color here}
\colorbox{yellowcmyk}{text} $\leftrightarrow$ \colorbox{-yellowcmyk}{complementary color here}
\colorbox{yellowHsb}{text} $\leftrightarrow$ \colorbox{-yellowHsb}{complementary color here}
\end{document}