TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to include some code using \usepackage{listings}. However the default look is not very pretty, so I want to customize it a bit. I've read some of the other posts about changing the layout of the code so I tried this:

    backgroundcolor=\color{yellow!20},% sets backgroundcolor
    \scriptsize \color{black},% basic font setting

But OliveGreen is undefined. Green is not good looking at all, so I would like to know how I can mix/create my own colors? Or maybe use another package with more standard colors in it.

share|improve this question
up vote 14 down vote accepted

The OliveGreen color is defined in dvipsnam.def, so you get it with


Alternatively, you can define it by stating


in your document preamble. In both cases, you can use the color by name where you wish.

With the dvipsnames option the OliveGreen color is defined in the CMYK model with what would be


but the same xcolor package will convert it to the rgb specification above.

This is what I get from the following test document:






which shows that the three ways of calling the color give the same result. However this can be different in the final printout, depending on the printer and the printer driver.

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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