Difference between revisions of "Color"

From Wiki
Jump to navigation Jump to search
m (added transparency hint)
(added multitone colors)
Line 5: Line 5:
 
Using colors with ConTeXt is easy:
 
Using colors with ConTeXt is easy:
 
* Start with <cmd>setupcolors</cmd><tt>[state=start]</tt>. Without that, everything appears in greys.
 
* Start with <cmd>setupcolors</cmd><tt>[state=start]</tt>. Without that, everything appears in greys.
* If you want only RGB or only CMYK color, use <tt>cmyk=no</tt> or <tt>rgb=no</tt>. It seems there are also spot and hexachrome colors possible, but I don't know yet how.
+
* If you want only RGB or only CMYK color, use <tt>cmyk=no</tt> or <tt>rgb=no</tt>. Multitone colors see below. Perhaps that covers spot colors and hexachrome also.
 
* Normally all colors are defined in RGB ''and'' CMYK and get converted if needed.
 
* Normally all colors are defined in RGB ''and'' CMYK and get converted if needed.
 
* You find lists of predefined colors in the files <tt>colo-xxx.tex</tt>, load them with <cmd>setupcolor</cmd><tt>[xxx]</tt>:
 
* You find lists of predefined colors in the files <tt>colo-xxx.tex</tt>, load them with <cmd>setupcolor</cmd><tt>[xxx]</tt>:
Line 44: Line 44:
  
 
Very interesting feature, to be described later... (see manual)
 
Very interesting feature, to be described later... (see manual)
 +
 +
=Multitones=
 +
 +
Hans wrote on the mailinglist on 2004-12-27 about handling of multitone colors:
 +
 +
Currently it's done by pdftools.rb
 +
 +
Once pdfxTeX becomes pdfeTeX out of a sudden your beta can do it as well.
 +
 +
I still need to figure out a way to automatically reverse the graphic, but one of these days you can start using it.
 +
 +
Actually, multitones for text already work out of the box:
 +
<texcode>
 +
\setupcolors[state=start]
 +
 +
\definecolor [blue]  [c=1,m=.38,y=0,k=.64]
 +
\definecolor [yellow] [c=0,m=.28,y=1,k=.06]
 +
 +
\definecolor [blue-100]  [blue]  [p=1]
 +
\definecolor [yellow-100] [yellow] [p=1]
 +
 +
\definemultitonecolor [combicolor]  [blue=.12,yellow=.28] [c=.1,m=.1,y=.3,k=.1]
 +
 +
\starttext
 +
 +
\startcolor[blue]\blackrule[width=3cm,height=3cm]\stopcolor
 +
 +
\startcolor[yellow]\blackrule[width=3cm,height=3cm]\stopcolor
 +
 +
\startcolor[combicolor]\blackrule[width=3cm,height=3cm]\stopcolor
 +
 +
\stoptext
 +
</texcode>
 +
(The CMYK color spec is the fall back color used on screen; one can preview separations in full Acrobat 7.)

Revision as of 22:55, 28 December 2004

< Visuals | Graphics >

Using Colors

Using colors with ConTeXt is easy:

  • Start with \setupcolors[state=start]. Without that, everything appears in greys.
  • If you want only RGB or only CMYK color, use cmyk=no or rgb=no. Multitone colors see below. Perhaps that covers spot colors and hexachrome also.
  • Normally all colors are defined in RGB and CMYK and get converted if needed.
  • You find lists of predefined colors in the files colo-xxx.tex, load them with \setupcolor[xxx]:
    • rgb: some simple colors, loaded by default (with translations for the different interface languages!)
    • xwi: X-Windows-colors
    • pra: PRAGMA ADE company colors
    • ema: Emacs colors
  • Try the magic \showcolor[xxx]!
  • Define your own colors with \definecolor[blablue][r=.1, g=.1, b=1, c=1, m=.1, y=0, k=0, s=.2] (definition for RGB, CMYK and Grey!)
  • You can define transparent colors through setting t, e.g. t=0.5. Beware, most PDF viewers and printshops can't handle PDF transparences!
  • Use the color name like [color=blablue] in some \setup... command.
  • Typeset single text elements with \color[blablue]{nice blue text} or longer sections with \startcolor[blablue] ... \stopcolor.

(See also "Color and Background" in the manual!)

Sample

\setupcolors[state=start]
\definecolor[blablue][r=.25, g=.1, b=1, c=1, m=.1, y=0, k=0, s=.2]

Here's some \color[blablue]{blue text} inbetween!

\showcolor[rgb]

Colorgroups and Palettes

\definecolorgroup[name][system][values]

\definepalet[palettename][colorname1=groupcolor:1, colorname2=groupcolor:2, ...]

Very interesting feature, to be described later... (see manual)

Multitones

Hans wrote on the mailinglist on 2004-12-27 about handling of multitone colors:

Currently it's done by pdftools.rb

Once pdfxTeX becomes pdfeTeX out of a sudden your beta can do it as well.

I still need to figure out a way to automatically reverse the graphic, but one of these days you can start using it.

Actually, multitones for text already work out of the box:

\setupcolors[state=start]

\definecolor [blue]   [c=1,m=.38,y=0,k=.64]
\definecolor [yellow] [c=0,m=.28,y=1,k=.06]

\definecolor [blue-100]   [blue]   [p=1]
\definecolor [yellow-100] [yellow] [p=1]

\definemultitonecolor [combicolor]   [blue=.12,yellow=.28] [c=.1,m=.1,y=.3,k=.1]

\starttext

\startcolor[blue]\blackrule[width=3cm,height=3cm]\stopcolor

\startcolor[yellow]\blackrule[width=3cm,height=3cm]\stopcolor

\startcolor[combicolor]\blackrule[width=3cm,height=3cm]\stopcolor

\stoptext

(The CMYK color spec is the fall back color used on screen; one can preview separations in full Acrobat 7.)