1

I am using xcolor to define two custom colors and try to implement them in my tcolorbox boxes. MWE:

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{tcolorbox}
\definecolor{myblue}{rgb}{3,78,170}
\definecolor{myred}{rgb}{255,243,212}
\begin{document}
\begin{tcolorbox}[colframe=myblue, colback=myred, toprule=1pt, bottomrule=0.5pt, leftrule=0pt, rightrule=0pt, arc=0pt]
TESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTE
TESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTEST
TESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTESTTEST
\end{tcolorbox}

\textcolor{myred}{Test?}

\end{document}

But there is no text visible. Also

  • 2
    rgb only accepts values between 0 and 1. Try with RGB instead. – leandriis Jan 14 '20 at 19:36
  • I swear I just copy and pasted my color definitions from another working document... But that was the answer. – Katjuscha Jan 14 '20 at 19:41
  • @leandriis Can you convert your comment into a response? – AndréC Jan 14 '20 at 19:49
  • @AndréC: done. Tanks for reminding me. – leandriis Jan 14 '20 at 20:24
  • Not duplicated, but similar problem: tex.stackexchange.com/q/304009/1952 – Ignasi Jan 15 '20 at 8:33
4

According the the xcolor documentation,

enter image description here the rgb color model only accepts values between 0 and 1. The RGB color model on the other hand accepts integers between 0 and 255, so swithing your definitions to

\definecolor{myblue}{RGB}{3,78,170}
\definecolor{myred}{RGB}{255,243,212}

gives you the desired result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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