Difference between revisions of "Command/definecolor"
< Command
Jump to navigation
Jump to search
m (more links) |
|||
| Line 61: | Line 61: | ||
</cd:parameter> | </cd:parameter> | ||
<cd:parameter name="a"> | <cd:parameter name="a"> | ||
| − | <cd:paramdoc>transparency mode (“alternative”), see [[Transparency]] and the [http://www.pragma-ade.nl/general/manuals/colors-mkiv.pdf color manual]. You can use the number or the name of a mode.</cd:paramdoc> | + | <cd:paramdoc>transparency mode (“alternative”), see [[Color/Defining_new_colors#Transparency|Transparency]] and the [http://www.pragma-ade.nl/general/manuals/colors-mkiv.pdf color manual]. You can use the number or the name of a mode.</cd:paramdoc> |
<cd:constant type="cd:number">mode number</cd:constant> | <cd:constant type="cd:number">mode number</cd:constant> | ||
<cd:constant type="none">no transparency</cd:constant> | <cd:constant type="none">no transparency</cd:constant> | ||
Latest revision as of 22:39, 11 January 2025
Contents
\definecolor
Summary
The command \definecolor is used to create or copy a named color.
Settings
| \definecolor[...][...=...,...] | |
| [...] | name |
| r | number |
| g | number |
| b | number |
| c | number |
| m | number |
| y | number |
| k | number |
| h | number |
| s | number |
| v | number |
| w | number |
| x | number |
| a | number none normal multiply screen overlay softlight hardlight colordodge colorburn darken lighten difference exclusion hue saturation color luminosity |
| t | number |
| Option | Explanation | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| color name, must not contain spaces or numbers | |||||||||||||||||||||||||||||||||||||||
| r |
| ||||||||||||||||||||||||||||||||||||||
| g |
| ||||||||||||||||||||||||||||||||||||||
| b |
| ||||||||||||||||||||||||||||||||||||||
| c |
| ||||||||||||||||||||||||||||||||||||||
| m |
| ||||||||||||||||||||||||||||||||||||||
| y |
| ||||||||||||||||||||||||||||||||||||||
| k |
| ||||||||||||||||||||||||||||||||||||||
| h |
| ||||||||||||||||||||||||||||||||||||||
| s |
| ||||||||||||||||||||||||||||||||||||||
| v |
| ||||||||||||||||||||||||||||||||||||||
| w |
| ||||||||||||||||||||||||||||||||||||||
| x |
| ||||||||||||||||||||||||||||||||||||||
| a |
| ||||||||||||||||||||||||||||||||||||||
| t |
| ||||||||||||||||||||||||||||||||||||||
Settings name
Description
\definecolor associates a name with a set of color values, for later use with the \color command.
You can omit 0 values.
Examples
Normal usage
% rgb \definecolor[bluu][r=.25, g=.1, b=1] Hey, \color[bluu]{look at that!} % hex \definecolor[salmon][x=AB5757] Hey, \color[salmon]{look at that!} \definecolor[brightorange][c=0, m=.4325, y=.9286, k=.0118] Hey, \color[brightorange]{orange you glad I didn't say banana?} \definecolor[darknavy][c=.9753, m=.4444, y=0, k=.6824] Hey, \color[darknavy]{is this dark navy?}

Defining derivative colors
Colors defined in terms of other colors are processed at the Lua end, unless they are direct clones. In that case, the new name is never told to Lua. That means that this does not work:
% direct clone, processed by TeX \definecolor[ColorA][red] % fails, ColorA not known to Lua \definecolor[ColorB][.5(ColorA)]
Writing it as a fake fraction works.
% definition involves a fraction, processed by Lua. \definecolor[ColorA][1.0(red)] % succeeds \definecolor[ColorB][.5(ColorA)]