2

I want to define colours with rgb palette. But I have found information like

Tiger Orange
Hex #F96815
RGB 249, 104, 21
CMYK 0, 58, 92, 2

When defining the colour, do the values have to be between 0.0 and 1.0, or can one use the scheme for Tiger Orange above?

\definecolor{red}{rgb}{1.0,0.0,0.0}
6
  • 3
    RGB instead of rgb for value between 0 and 255. And HTML for a CSS-style hexadecimal notation. Sep 22, 2022 at 4:28
  • 5
    xcolor has a quite good documentation. Sep 22, 2022 at 5:57
  • Does not look that CMYK can be whole values though.
    – Veak
    Sep 22, 2022 at 7:30
  • 2
    No, CMYK does not exist. But typically, CMYK values are either going from 0 to 1 or from 0 to 100. So conversion is quite simple, since you just need to divide the above values by 100: \definecolor{Tiger Orange}{cmyk}{0, .58, .92, .02}. Sep 22, 2022 at 8:51
  • Test yourself
    – Fran
    Sep 22, 2022 at 14:58

1 Answer 1

3

Following answer from @Teddy

For rgb values between 0 and 255, RGB is used rather than rgb.

Thus,

\definecolor{TigerOrange}{RGB}{249,104,21}
3
  • 1
    Maybe the color should have a the name Tiger Orange since it is not really red in my opinion. Sep 22, 2022 at 17:06
  • 1
    Quite right about your point. Updated. Have not found any indications whether spaces or punctuation are allowed in the colour name for \definecolor[⟨type⟩]{⟨name⟩}{⟨model-list⟩}{⟨spec-list⟩}. So I have used CamelCase by defining the name as TigerOrange.
    – Veak
    Sep 22, 2022 at 18:56
  • 1
    You are right. The xcolor manual states (on page 12 [v2.14]): "Actually, besides letters and digits, certain other characters do also work for ⟨name⟩ declarations, but the given restriction avoids misunderstandings and ensures compatibility with future extensions of xcolor." So, the use of a space should probably be discouraged (even if it might work) and CamelCase is the way to go here. Sep 22, 2022 at 19:03

You must log in to answer this question.

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