I want to define a new colour (myorange) by changing the hue value of a previously given colour (oldcolour), thus maintaining its original saturation and brightness. Is there a way for doing this?

I can think of two strategies. First, having a function \changehue that returns a colour from another, but with a hue defined by the user. It would be used as follows:


Or maybe:


In this last case, \changehue would extract the hue of orange and plug it into the code. This way would be better for me.

In the second strategy, we just define the colour with the definecolor with the hsb colour model with the help of functions for extracting the hue, saturation and brightness of the colour previously given.

\definecolor{myorange}{hsb}{\hue{orange}, \saturation{oldcolour}, \brightness{oldcolour}}

I strongly prefer this second strategy, which is the way presupposed by my question. It would be useful to know if commands like \hue, \saturation, and \brightness exist or can be defined.

Thanks in advance for your help.

  • 1
    This varies the hue value: \documentclass{article} \usepackage{xcolor} \newcounter{myc} \begin{document} \definecolorseries{changehue}{hsb}{step}{orange}{0,0.1,0} \resetcolorseries[12]{changehue}% \loop\stepcounter{myc}\colorlet{mycolor}{changehue!![\number\value{myc}]} \textcolor{mycolor}{X}\ifnum\value{myc}<11\repeat \end{document} but you want to retrieve it from a given color, right?
    – user194703
    Sep 27, 2019 at 3:01
  • Thanks, @Schrödinger'scat. Your proposal is very helpful and corresponds to the first strategy. It would be great, though, if something approximating the second could be proposed.
    – lfba
    Sep 27, 2019 at 3:06
  • I agree with that, which is why I upvoted this question. ;-)
    – user194703
    Sep 27, 2019 at 3:08

1 Answer 1


This might be a partial answer. You can define a color series and vary, say, the hue value. The perhaps more important information is that \extractcolorspecs allows you to extract the color specifications of a given color. This can be converted to a given color scheme with \convertcolorspec. The last two commands have been merged to the \convertdirectly command, which I am recycling here.

% from https://tex.stackexchange.com/a/283618
  \message{#2 in #1 is \tmp^^J}%

the hsb ``code'' of orange is \convertdirectly{orange}{\hsborange}\hsborange

the hsb ``code'' of brown is \convertdirectly{brown}{\hsbbrown}\hsbbrown

hue of orange=\hue{orange}

saturation of orange=\saturation{orange}

brightness of orange=\brightness{orange}




enter image description here


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .