Jump to content

User:Isaacl/Colour convert/doc

From Wikipedia, the free encyclopedia

Usage[edit]

{{User:Isaacl/Colour convert|127|0|255|to=sRGB}}
{{User:Isaacl/Colour convert|49.803921568627%|0%|100%|to=sRGB24bit}}
{{User:Isaacl/Colour convert|steelblue|from=W3Cnames|to=sRGB24bit}}

This template can convert to and from the following display formats:

  • sRGB floating point: xx%, yy%, zz% where each value is between 0 and 100%
  • sRGB 24-bit: XX, YY, ZZ where each value is between 0 and 255
  • sRGB 24-bit hex: #XX, #YY, #ZZ where each value is a hex number between 00 and FF
  • sRGB 24-bit hex string: #XXYYZZ where XX, YY, and ZZ are hex numbers between 00 and FF
  • W3C colour names: a name as defined in W3C CSS Color Module Level 3

The starting display format is specified using the "from" parameter, and the final display format is specified using the "to" parameter, using the following values:

Display format value for "from"/"to" parameter example
sRGB floating point sRGB {{User:Isaacl/Colour convert|49.803921568627%|0%|100%|from=sRGB|to=sRGB24bit}}
sRGB 24-bit sRGB24bit {{User:Isaacl/Colour convert|127|0|255|from=sRGB24bit|to=sRGB}}
sRGB 24-bit hex sRGB24bitHex {{User:Isaacl/Colour convert|#7F|#00|#FF|from=sRGB24bitHex|to=sRGB}}
sRGB 24-bit hex string sRGB24bitHexString {{User:Isaacl/Colour convert|#7F00FF|from=sRGB24bitHexString|to=sRGB}}
W3C colour names W3Cnames {{User:Isaacl/Colour convert|steelblue|from=W3Cnames|to=sRGB24bit}}

The template will automatically deduce if the starting display format is sRGB floating point, sRGB 24-bit, sRGB 24-bit hex, or sRGB 24-bit hex string, if the format shown in the examples is followed.

Examples[edit]

See also[edit]