Changes

Jump to navigation Jump to search
200 bytes added ,  13:36, 1 June 2009
Reorganized contents
<cmd>setupcolors</cmd><tt>[state=start]</tt>
=Using Defining Colors=
Using colors with ConTeXt is easy:
<cmd>definecolor</cmd><tt>[blablue][r=.1, g=.1, b=1, c=1, m=.1, y=0, k=0, s=.2]</tt> (definition for RGB, CMYK and Grey!)
* You can define '''transparent''' colors through setting t, e.g. <tt>t=0.5</tt>. Beware, most PDF viewers and printshops can't handle PDF transparences!
* Use the color name like <tt>[color=blablue]</tt> in some <tt>\setup...</tt> command.
* Typeset single text elements with <cmd>color</cmd><tt>[blablue]{nice blue text}</tt> or longer sections with <cmd>startcolor</cmd><tt>[blablue] ...</tt> <cmd>stopcolor</cmd>.
(See also "Color and Background" in the manual!)
{|
|}
=Colorgroups == Colors with Hexadecimal Numbers === You can also use hexadecimal numers to specify colors. You need to load the '''hex''' color module first:{| ! width="45%"| ! width="10%"| ! width="45%"| |- | <texcode>\setupcolor[hex]\definecolor[salmon][h=AB5757] Hey, \color[salmon]{look at that!}</texcode>||<context>\setupcolors[state=start]\setupcolor[hex]\definecolor[salmon][h=AB5757] Hey, \color[salmon]{look at that!}</context>|} ===Transparent Colors=== You can define '''transparent''' colors through setting t, e.g. <tt>t=0.5</tt>. Beware, some PDF viewers and Palettesprintshops can't handle PDF transparences! Hans Hagen posted the following sample code for transparent colors on the mailing list on 2005-07-13; the yellow blocks have been added to demonstrate the order in which the blocks are drawn on the page; the first yellow block is behind the transparent red and blue blocks, while the second is in front of them. {| ! width="45%"| ! width="10%"| ! width="45%"| |- | <texcode>\definecolor [transparentred] [r=1,t=.5,a=1]\definecolor [transparentblue] [b=1,t=.5,a=1]\definecolor [solidyellow] [y=1,t=1,a=1] \starttext \startTEXpageThis is some sample text that goes behind the rectangles\hskip-8cm\blackrule[width=2cm,height=1cm,depth=1cm,color=solidyellow]\hskip-0.67cm\blackrule[width=2cm,height=2cm,color=transparentred]\hskip-0.67cm\blackrule[width=2cm,height=1cm,depth=1cm,color=transparentblue]\hskip-0.67cm\blackrule[width=2cm,height=2cm,color=solidyellow]\hskip2cm.\stopTEXpage \stoptext</texcode>||<context>\setupcolors[state=start]\definecolor [transparentred] [r=1,t=.5,a=1]\definecolor [transparentblue] [b=1,t=.5,a=1]\definecolor [solidyellow] [y=1,t=1,a=1] \starttext \startTEXpageThis is some sample text that goes behind the rectangles\hskip-8cm\blackrule[width=2cm,height=1cm,depth=1cm,color=solidyellow]\hskip-0.67cm\blackrule[width=2cm,height=2cm,color=transparentred]\hskip-0.67cm\blackrule[width=2cm,height=1cm,depth=1cm,color=transparentblue]\hskip-0.67cm\blackrule[width=2cm,height=2cm,color=solidyellow]\hskip2cm.\stopTEXpage \stoptext</context>|} == Defining color schemes: <cmd>definecolorgroup</cmd> and <cmd>definepalet</cmd>==
<cmd>definecolorgroup</cmd><tt>[name][system][values]</tt>
Very interesting feature, to be described later... (see manual)
 
=Using Colors=
 
* Use the color name like <tt>[color=blablue]</tt> in some <tt>\setup...</tt> command.
* Typeset single text elements with <cmd>color</cmd><tt>[blablue]{nice blue text}</tt> or longer sections with <cmd>startcolor</cmd><tt>[blablue] ...</tt> <cmd>stopcolor</cmd>.
=Spot colours=
(The CMYK color spec is the fall back color used on screen; one can preview separations in full Acrobat 7.)
=Transparent Colors=
As mentioned earlier, transparent colors can be produced by setting the <tt>t</tt> value for the color. Hans Hagen posted the following sample code for transparent colors on the mailing list on 2005-07-13; the yellow blocks have been added to demonstrate the order in which the blocks are drawn on the page; the first yellow block is behind the transparent red and blue blocks, while the second is in front of them.
 
<texcode>
\setupcolors[state=start]
\definecolor [transparentred] [r=1,t=.5,a=1]
\definecolor [transparentblue] [b=1,t=.5,a=1]
\definecolor [solidyellow] [y=1,t=1,a=1]
 
\starttext
 
\startTEXpage
This is some sample text that goes behind the rectangles\hskip-8cm
\blackrule[width=2cm,height=1cm,depth=1cm,color=solidyellow]\hskip-0.67cm
\blackrule[width=2cm,height=2cm,color=transparentred]\hskip-0.67cm
\blackrule[width=2cm,height=1cm,depth=1cm,color=transparentblue]\hskip-0.67cm
\blackrule[width=2cm,height=2cm,color=solidyellow]\hskip2cm.
\stopTEXpage
 
\stoptext
</texcode>
 
<context>
\setupcolors[state=start]
\definecolor [transparentred] [r=1,t=.5,a=1]
\definecolor [transparentblue] [b=1,t=.5,a=1]
\definecolor [solidyellow] [y=1,t=1,a=1]
 
\starttext
 
\startTEXpage
This is some sample text that goes behind the rectangles\hskip-8cm
\blackrule[width=2cm,height=1cm,depth=1cm,color=solidyellow]\hskip-0.67cm
\blackrule[width=2cm,height=2cm,color=transparentred]\hskip-0.67cm
\blackrule[width=2cm,height=1cm,depth=1cm,color=transparentblue]\hskip-0.67cm
\blackrule[width=2cm,height=2cm,color=solidyellow]\hskip2cm.
\stopTEXpage
 
\stoptext
</context>
=Colorizing Grayscale Pictures=
</texcode>
= Colors with Hexadecimal Numbers References =
You can also use hexadecimal numers to specify colors. You need to load See "Color and Background" in the '''hex''' color module first:<texcode>\setupcolor[hex]</texcode>and then you may define colors with<texcode>\definecolor[hex-red][h=FF0000]</texcode>manual

Navigation menu