Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have defined a new color with \definecolor{MyBlue}{rgb}{0.25,0.5,0.75}. Is it possible to define now "derivatives" of this in term of shades? I would like to use the same color in three different shades. It is possible to do this with grey by default, but can I define one mu own? Like

\definecolor{NextBlue}{MuBlue}{0.75}

I use the xcolor package.

share|improve this question

1 Answer 1

up vote 25 down vote accepted

According to the answer at Defining a Color using another, the \colorlet macro is what you should use to define the new color in terms of old ones. Then you can specify shade variations on the new color.

\documentclass{article}
\usepackage{xcolor}
\colorlet{NextBlue}{red!25!green!50!blue!75}
\begin{document}
\colorbox{NextBlue}{Test}
\colorbox{NextBlue!20}{Test}
\colorbox{NextBlue!40}{Test}
\end{document}

Image for test sample 1

Or

\documentclass{article}
\usepackage{xcolor}
\definecolor{MyBlue}{rgb}{0.25,0.5,0.75}
\colorlet{NextBlue}{MyBlue!20}
\colorlet{SecondBlue}{MyBlue!40}
\begin{document}
\colorbox{MyBlue}{Test}
\colorbox{NextBlue}{Test}
\colorbox{SecondBlue}{Test}
\end{document}

Image for test sample 2

With shades between MyBlue and gray:

\documentclass{article}
\usepackage{xcolor}
\definecolor{MyBlue}{rgb}{0.25,0.5,0.75}
\colorlet{NextBlue}{MyBlue!60!gray}
\colorlet{SecondBlue}{MyBlue!30!gray}
\begin{document}
\colorbox{MyBlue}{Test}
\colorbox{NextBlue}{Test}
\colorbox{SecondBlue}{Test}
\end{document}

enter image description here

share|improve this answer
    
@HarishKumar Thank you for expanding the scope of the answer! –  Steven B. Segletes May 26 at 23:55
    
Thank you. That is exactly what I was looking for! –  CPJ May 27 at 7:03
    
To all the editors who have improved my answer, thank you. –  Steven B. Segletes May 27 at 10:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.