6

I want to know how to define a light gray color with beamer. I am using this color to shade a small block of my text.

Here is the code I am using for defining my colors.

\definecolor{shadecolor}{rgb}{0.01,0.199,0.1}

The current color is giving me a very dark green. I am not sure how to change this to light gray. Can some one help with this ?

Beamer only seems to be accepting values between 0 and 1.

This link does give values for gray but I think it is for some other units. http://www.tayloredmktg.com/rgb/

2
  • 3
    Shades of gray consist of equal amounts of r ed, g reen and b lue, so you could use something like \definecolor{shadecolor}{rgb}{0.5,0.5,0.5} or \definecolor{shadecolor}{rgb}{0.8,0.8,0.8}.
    – Jake
    Aug 22, 2012 at 15:00
  • 1
    You can also simply say: \colorlet{shadecolor}{gray!40} (which means 40%gray and 60% white). Aug 22, 2012 at 17:30

2 Answers 2

20

A simple solution would be to use some predefined gray color and the ! syntax together with \colorlet; for example:

\colorlet{shadecolor}{gray!40}

(40% gray and 60% white); increasing the value used will produce darker shades and decreasing it, lighter ones.

3

The Link you provided, mentiones the values of RGB (red green blue as mention by @Jake in the comments above) in a range from 0 to 255, i.e. in 8 bit values each. To convert to your needs, divide the values by 256. You can even let beamer to the calcucaltions and use fractions. For example \definecolor{shadecolor}{rgb}{190/256,190/256,190/256} should work as fine as \definecolor{shadecolor}{rgb}{0.7421875,0.7421875,0.7421875} using the values for gray from your link

2
  • 3
    beamer and TikZ use xcolor under the hood so you can directly use integer models via \definecolor{shadecolor}{RGB}{190,190,190} Hex model is also supported.
    – percusse
    Aug 22, 2012 at 15:54
  • Oh, i forgot about that, of course; it does. So for integer values colors (0..255) xcolor provides the capital RGB color model and for percental values (0..1) the rgb model. Thanks for the hint.
    – Ronny
    Aug 22, 2012 at 16:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .