Module:Color/doc: Difference between revisions
Appearance
Content deleted Content added
m Convenience range mapping |
mNo edit summary |
||
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> |
||
To mix two colors: |
To mix two colors in the more physically correct linear color space: |
||
:<code><nowiki>{{</nowiki>#invoke:Color|''hexMix''<nowiki>|color1|color2|proportion|min=?|max=?}}</nowiki></code> |
:<code><nowiki>{{</nowiki>#invoke:Color|''hexMix''<nowiki>|color1|color2|proportion|min=?|max=?}}</nowiki></code> |
||
Revision as of 14:46, 17 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=?}}
To mix two colors in the more physically correct linear color space:
{{#invoke:Color|hexMix|color1|color2|proportion|min=?|max=?}}
The following parameters are optional:
precision
: defaults to0
(zero)pctsign
: set to0
(zero) to suppress percent signs in the generated outputproportion
: proportion ofcolor2
, defaults to 50min
: minimum value of proportion range, defaults to 0max
: maximum value of proportion range, defaults to 100