1

I'm quite new to overleaf, im looking to change a box to the color of royalpurple, the shade of Loughborough university's logo as the header color and a lighter version as the boxes background. Any values I edit turns the colors black or a color that doesn't represent the color I input. Can someone show me how its done please? I cant find any tutorials that work, unless I'm missing something.

\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}

\usepackage{tcolorbox}
\usepackage[listings]{tcolorbox}


\begin{document}
\newtcolorbox{mybox}[2][]{colback=RoyalPurple!5!white,
colframe=RoyalPurple!75!black,fonttitle=\bfseries,
colbacktitle=Royapurple!85!black,enhanced,
attach boxed title to top center={yshift=-2mm},
title=#2,#1} 
\begin{mybox}[colback=purpl]{Hello there}
This is my own box with a mandatory title
and options.
\end{mybox}
\end{document}
Leucippus
  • 1,636
  • 1
    Welcome! Use \documentclass[12pt,dvipsnames]{article} \usepackage[english]{babel} \usepackage[utf8x]{inputenc} \usepackage{amsmath} \usepackage[listings,skins]{tcolorbox} \begin{document} \newtcolorbox{mybox}[2][]{colback=RoyalPurple!5!white, colframe=RoyalPurple!75!black,fonttitle=\bfseries, colbacktitle=RoyalPurple!85!black,enhanced, attach boxed title to top center={yshift=-2mm}, title=#2,#1} \begin{mybox}[colback=purple]{Hello there} This is my own box with a mandatory title and options. \end{mybox} \end{document}. –  May 29 '20 at 18:08
  • Thankyou so much! you dont know how much i appreciate it! :) – Miles Routledge May 29 '20 at 18:16

1 Answers1

1

I will be happy to delete this since it is really just correcting a number of typos and omissions.

  1. In order to use RoyalPurple, you need to make sure that xcolor is loaded with the dvipsnames option. One way of achieving this is to add dvipsnames to the options of \documentclass.
  2. You load tcolorbox twice. However, for enhanced you need the skins library. And loading it once is sufficient. While you do not use listings here, I kept it and load \usepackage[listings,skins]{tcolorbox}.
  3. There were typos in the colors. RoyalPurple got misspelled as Royapurple, and purple as purpl.

Fixing these omissions and typos yields

\documentclass[12pt,dvipsnames]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage[listings,skins]{tcolorbox}
\begin{document}
\newtcolorbox{mybox}[2][]{colback=RoyalPurple!5!white,
colframe=RoyalPurple!75!black,fonttitle=\bfseries,
colbacktitle=RoyalPurple!85!black,enhanced,
attach boxed title to top center={yshift=-2mm},
title=#2,#1} 
\begin{mybox}[colback=purple]{Hello there}
This is my own box with a mandatory title
and options.
\end{mybox}
\end{document}

enter image description here