13

I have a color hex string, e.g. ecd9ed, I know I can define it as below:

\definecolor{color1bg}{RGB}{236,217,237}

But I wish to skip the conversion from hex to decimal. Is it possible to define a color in hex string? Maybe something like below:

\definecolor{color1bg}{RGB}{#ecd9ed}
3
  • 14
    Try \definecolor{color1bg}{HTML}{ECD9ED} ... Also, this is an xcolor command and possibly tikz is loading it but it is not its job this command...
    – koleygr
    Commented Jun 17, 2019 at 20:40
  • 1
    @koleygr can you add your comment as an answer so the question can be closed? Commented Aug 21, 2021 at 1:43
  • done @jessexknight ... Thanks!
    – koleygr
    Commented Aug 21, 2021 at 6:51

1 Answer 1

18

\definecolor{color1bg}{HTML}{ECD9ED} is the way to define colors with HTML definition.

You need the package xcolor of course.

1
  • 2
    Thanks! Just also confirming that tikz does indeed load xcolor already, as you mentioned above. Commented Aug 21, 2021 at 13:33

You must log in to answer this question.

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