Difference between revisions of "Command/definepalet"

From Wiki
Jump to navigation Jump to search
m (→‎Description: brief description.)
(→‎Description: inserted note concerning syntax oddities)
Line 22: Line 22:
 
== Description ==
 
== Description ==
 
Allows on-the-fly switching of whole sets of color name definitions.
 
Allows on-the-fly switching of whole sets of color name definitions.
 +
 +
'''NB'''
 +
{{cmd|definepalet}} relies on a non-standard argument parser that does
 +
not tolerate trailing commas [http://www.ntg.nl/pipermail/ntg-context/2012/067602.html].
 +
Therefore the following syntax is illegal:
 +
<texcode>
 +
\definepalet [foo] [
 +
  first=red,
 +
  second=green, %% <= will fail
 +
]
 +
</texcode>
 +
Use common ConTeXt coding style instead:
 +
<texcode>
 +
\definepalet [foo]
 +
[first=green,
 +
  second=red]
 +
</texcode>
 +
 +
Alternatively, replace the comma with a comment character:
 +
<texcode>
 +
\definepalet [foo] [
 +
  first=green,
 +
  second=red%
 +
]
 +
</texcode>
  
 
== Example ==
 
== Example ==

Revision as of 12:37, 16 June 2012

\definepalet

Syntax

\definepalet[...][...,...=...,...]
[...] name
name name


Description

Allows on-the-fly switching of whole sets of color name definitions.

NB \definepalet relies on a non-standard argument parser that does not tolerate trailing commas [1]. Therefore the following syntax is illegal:

\definepalet [foo] [
  first=red,
  second=green, %% <= will fail
]

Use common ConTeXt coding style instead:

\definepalet [foo]
 [first=green,
  second=red]

Alternatively, replace the comma with a comment character:

\definepalet [foo] [
  first=green,
  second=red%
]

Example

\setupcolors [x11]
\definepalet [colorful] [primary=green]
\definepalet [bleak]    [primary=darkgray]
\starttext

\setuppalet  [colorful]
\color[primary]{Ain’t I a colorful entity?}

\setuppalet  [bleak]
\color[primary]{Ain’t I a colorful entity?}

\stoptext

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: