1

The documentation for tcolorbox suggests that the usual xcolor literals such as red!75!black can be used when specifying colour options.

However... Is it possible to specify RGB colour literals without the intermediate use of \definecolor or \colorlet?

The only way I've managed this so far is using:

\documentclass{standalone}

\usepackage{tcolorbox}

\begin{document} \definecolor{cellcolor}{rgb}{0.5,0.6,0.8} \tcbox[colback=cellcolor]{Some text} \end{document}

Whereas I was hoping that something akin to the following would be possible:

\documentclass{standalone}

\usepackage{tcolorbox}

\begin{document} \tcbox[colback={[rgb]{0.5,0.6,0.8}}]{Some text} \end{document}

For a single box this isn't an issue. However, where I'm intending to create multiple boxes with various interior fills, I can't help but wonder if there is an easier way!

I appreciate there are a couple of existing similar(-ish) questions, but I can't find anything for this particular issue.

RMills330
  • 111
  • 4
    \tcbox[colback={rgb,1:red,0.5;green,0.6;blue,0.6}]{Some text} will work (see https://tex.stackexchange.com/a/343680/2388), but imho it is much better to define the colors first. This keeps such definitions in one place. – Ulrike Fischer Dec 21 '22 at 20:25
  • Thanks @UlrikeFischer... I note your point regarding defining colours up-front. However, for the intended use here, having them expressed as literals in this way is perfect for my needs. I also wish I'd spotted that section on extended colour expressions! If you put this as answer, you'd win the points! – RMills330 Dec 21 '22 at 20:30

0 Answers0