0

I need more colours than the standard colours of the package xcolor. I have also tried the dvipsnames xcolor package but it didn't work. Every time when I tried to highlight a text with color from from the package, like ForestGreen, my text became black. I would like to have a color like in the image. Can anyone please help me?enter image description here

New contributor
user257460 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
5
  • 8
    Welcome to TeX.SE! Please show us a short compilable TeX code resulting in your issue! Then we do not have to guess what you are doing ...
    – Mensch
    Nov 25 at 13:25
  • 1
    Try RGB 0,209,239 Nov 25 at 14:09
  • 2
    I don't think that the duplicate fits, but the question is clearly much to vage and unclear currently. Some code that shows what doesn't work is needed. Nov 25 at 16:30
  • It looks like all he wants, really, is a way to obtain “more colours than the standard colours of the package xcolor”. There are numerous ways to achieve that.
    – Ingmar
    Nov 25 at 16:54
  • 2
    Maybe you’d be interested in packages like xcolor-material, xcolor-solarized, and xkcdcolors?
    – Thérèse
    Nov 25 at 17:07
3

David Carlisle with his package color, which belongs to the graphics-bundle, is one of the forerunners when it comes to colour support in LaTeX. Many other packages build on it.

A starting point in learning about commands for typesetting text in colour might be section "3 Colour" of "Packages in the 'graphics' bundle" by David Carlisle and The LaTeX Project, often referenced as grfguide.pdf. Packages like xcolor, too, bring along the basic commands described there.

Probably the following example does help you?

enter image description here

\documentclass[a4paper]{article}
%\usepackage[dvipsnames,usenames]{color}
\usepackage[dvipsnames]{xcolor}

\newcommand\PassColors[2][black]{%
  \fbox{%
    \colorbox{#2}{\textcolor{#1}{%
      \vbox to1cm{\vfill\hbox to 2.5cm{\hfill#2\hfill}\vfill}%
    }}%
  }\hskip.5em%
}%

\begin{document}

\enlargethispage{5mm}

\hrule height 0pt \vskip-4cm

{%
\large
\par\medskip\noindent
This is how you get colored text:
\fboxrule=3\fboxrule
\par\medskip\noindent
\verb|\fcolorbox{blue}{yellow}{\textcolor{red}{Test}}|: \fcolorbox{blue}{yellow}{\textcolor{red}{Test}}
\par\medskip\noindent
\verb|\colorbox{yellow}{\textcolor{red}{Test}}|: \colorbox{yellow}{\textcolor{red}{Test}}
\par\medskip\noindent
\verb|\textcolor{red}{Test}|: \textcolor{red}{Test}
\par\bigskip
}%


{%
  \fboxsep=0ex
  \fboxrule=2pt
  \par\bigskip\noindent
  {\large These are the colors provided by the option dvipsnames/according to dvips' color.pro:}
  \par\medskip\noindent
  \csname@for\endcsname\colors:=%
    {{GreenYellow}},{{Yellow}},%
    {{Goldenrod}},{{Dandelion}},{{Apricot}},{{Peach}},{{Melon}},{{YellowOrange}},{{Orange}},%
    {{BurntOrange}},{{Bittersweet}},{{RedOrange}},{{Mahogany}},{{Maroon}},{{BrickRed}},%
    {{Red}},{{OrangeRed}},{{RubineRed}},{{WildStrawberry}},{{Salmon}},{{CarnationPink}},%
    {{Magenta}},{{VioletRed}},{{Rhodamine}},{{Mulberry}},{{RedViolet}},{{Fuchsia}},{{Lavender}},%
    {{Thistle}},{{Orchid}},{{DarkOrchid}},{{Purple}},{{Plum}},{{Violet}},{{RoyalPurple}},%
    {{BlueViolet}},{{Periwinkle}},{{CadetBlue}},{{CornflowerBlue}},{{MidnightBlue}},{{NavyBlue}},%
    {{RoyalBlue}},{{Blue}},{{Cerulean}},{{Cyan}},{{ProcessBlue}},{{SkyBlue}},{{Turquoise}},%
    {{TealBlue}},{{Aquamarine}},{{BlueGreen}},{{Emerald}},{{JungleGreen}},{{SeaGreen}},%
    {{Green}},{{ForestGreen}},{{PineGreen}},{{LimeGreen}},{{YellowGreen}},{{SpringGreen}},%
    {{OliveGreen}},{{RawSienna}},{{Sepia}},{{Brown}},{{Tan}},{{Gray}},{[White]{Black}},{{White}}%
  \do{\expandafter\PassColors\colors}%
}%

\par\medskip\noindent
Note that when using the package \textbf{color} instead of the package \textbf{xcolor}, besides the option \textbf{dvipsnames}, after \textbf{dvipsnames} you also need to specify the option \textbf{usenames}.
\par\medskip\noindent
Note that document-classes like \textbf{beamer} and some packages internally load \textbf{xcolor} so that you need to specify options for \textbf{xcolor} already with the directives for loading these document-classes/packages.\\
Otherwise you might get errors about option-clashes and the like where with online-platforms like overleaf you need to view the so-called "raw log" for taking notice. The "raw-log" is the .log-file provided by the LaTeX-compiler itself while the LaTeX-compiler is running and what people asking for .log-file wish to see.

\end{document}
1
  • 1
    Please be reluctant in upvoting answers of mine for a while. I am not in the condition for accessing trusted user tools. ;-> Nov 25 at 17:08

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