Module:Color/doc: Difference between revisions
From Neodyland Wiki
More actions
m →Usage |
mNo edit summary |
||
| Line 9: | Line 9: | ||
To convert a hexadecimal triplet to the [[CMYK color model]] without a color profile: | To convert a hexadecimal triplet to the [[CMYK color model]] without a color profile: | ||
:<code><nowiki>{{</nowiki>#invoke:Color|''hexToCmyk''<nowiki>|color|precision=?}}</nowiki></code> | :<code><nowiki>{{</nowiki>#invoke:Color|''hexToCmyk''<nowiki>|color|precision=?|pctsign=?}}</nowiki></code> | ||
To convert a hexadecimal triplet to [[HSL and HSV|HSL or HSV]]: | To convert a hexadecimal triplet to [[HSL and HSV|HSL or HSV]]: | ||
| Line 18: | Line 18: | ||
:<code><nowiki>{{</nowiki>#invoke:Color|''hexToCielch''<nowiki>|color|precision=?}}</nowiki></code> | :<code><nowiki>{{</nowiki>#invoke:Color|''hexToCielch''<nowiki>|color|precision=?}}</nowiki></code> | ||
The <code>precision</code> | The following parameters are optional: | ||
* <code>precision</code>: defaults to zero | |||
* <code>pctsign</code>: set to <code>0</code> (zero) to suppress percent signs in the generated output | |||
<includeonly>{{Sandbox other|| | <includeonly>{{Sandbox other|| | ||
[[Category:Modules handling colors]] | [[Category:Modules handling colors]] | ||
}}</includeonly> | }}</includeonly> | ||
Revision as of 11:12, 11 January 2022
This module is used primarily by {{Infobox color}}, eliminating the need for external color converters and preventing mismatch between color coordinates.
Usage
To use this module, you may use one of the above listed templates or invoke the module directly. All functions that accept hexadecimal triplets also handle the shorthand three-digit format.
To convert a hexadecimal triplet to an RGB triplet as comma-separated values:
{{#invoke:Color|hexToRgbTriplet|color}}
To convert a hexadecimal triplet to the CMYK color model without a color profile:
{{#invoke:Color|hexToCmyk|color|precision=?|pctsign=?}}
To convert a hexadecimal triplet to HSL or HSV:
{{#invoke:Color|hexToHsl|color|precision=?}}{{#invoke:Color|hexToHsv|color|precision=?}}
To convert a hexadecimal triplet to the perceptual CIELChuv color space:
{{#invoke:Color|hexToCielch|color|precision=?}}
The following parameters are optional:
precision: defaults to zeropctsign: set to0(zero) to suppress percent signs in the generated output