MODULES Uize.Color.xCmyk
1. Introduction
The Uize.Color.xCmyk
module extends the Uize.Color
object by adding a profile for the CMYK
color space, and by providing encodings for this color space.
DEVELOPERS: Chris van Rensburg
The Uize.Color.colorSpaces.CMYK
property - defined in this extension - provides a profile for the CMYK (Cyan, Magenta, Yellow, Key) color space. The CMYK color model is a subtractive color model used to describe the printing process. Some examples of CMYK formatted colors can be viewed at http://www.december.com/html/spec/colorcmyk.html.
1.1. Examples
The following example pages are good showcases for the Uize.Color.xCmyk
module...
Color Format Converter - Easily convert color values from one format to another. Convert between RGB hex, RGB tuple string, HSL, HSV, CMYK, and SVG color names. |
SEARCH FOR EXAMPLES
Use the link below to search for example pages on the UIZE Web site that reference the Uize.Color.xCmyk
module...
SEARCH
1.2. Implementation Info
The Uize.Color.xCmyk
module defines the Uize.Color.xCmyk
extension module under the Uize.Color
namespace.
1.2.1. Features Introduced in This Module
The features listed in this section have been introduced in this module.
STATIC PROPERTIES
Uize.Color.xCmyk.moduleName
| Uize.Color.xCmyk.pathToResources
1.2.2. Features Overridden in This Module
No features have been overridden in this module.
1.2.3. Features Inherited From Other Modules
This module has no inherited features.
1.2.4. Modules Directly Under This Namespace
There are no modules directly under this namespace.
1.2.5. Unit Tests
There is no dedicated unit tests module for the Uize.Color.xCmyk
module.
2. Color Encodings
The Uize.Color.xCmyk
extension implements support for the following color encodings / formats...
2.1. CMYK array
An array, containing four elements for cyan, magenta, yellow, and key components of the color, whose values may be floating point numbers in the range of 0
to 100
(e.g. the color chartreuse is encoded as [50,0,100,0]
).
SYNTAX
[ cyan0to100FLOAT, magenta0to100FLOAT, yellow0to100FLOAT, key0to100FLOAT ]
2.1.1. Encoding
When a color is encoded as CMYK array
, the resulting array is made up of four number type elements that represent the values of the source color's cyan, magenta, yellow, and key components, respectively.
EXAMPLES | |
COLOR NAME | CMYK array |
fuchsia | [0,100,0,0] |
yellow | [0,0,100,0] |
blue | [100,100,0,0] |
white | [0,0,0,0] |
2.1.2. Decoding
When a color is decoded from CMYK array
, the values of the array's four elements may be numbers, strings, or any object that implements a valueOf
interface (such as an instance of a Uize.Class
subclass that implements the value
state property).
The values will be coerced to number type by invoking the valueOf Intrinsic Method
.
EXAMPLES
[0,100,0,0] // fuchsia ['0','100','0','0'] // fuchsia [cyanSlider,magentaSlider,yellowSlider,keySlider]
NOTES
string values for the elements of the array may not contain a "%" (percent) suffix |
2.2. CMYK object
An object, containing cyan
, magenta
, yellow
, and key
properties, whose values may be floating point numbers in the range of 0
to 100
(e.g. the color chartreuse is encoded as {cyan:50,magenta:0,yellow:100,key:0}
).
SYNTAX
{ cyan : cyan0to100FLOAT, magenta : magenta0to100FLOAT, yellow : yellow0to100FLOAT, key : key0to100FLOAT }
2.2.1. Encoding
When a color is encoded as CMYK object
, the resulting object will contain the four number type properties cyan
, magenta
, yellow
, and key
, reflecting the values of the source color's cyan, magenta, yellow, and key components, respectively.
EXAMPLES | |
COLOR NAME | CMYK object |
fuchsia | {cyan:0,magenta:100,yellow:0,key:0} |
yellow | {cyan:0,magenta:0,yellow:100,key:0} |
blue | {cyan:100,magenta:100,yellow:0,key:0} |
white | {cyan:0,magenta:0,yellow:0,key:0} |
2.2.2. Decoding
When a color is decoded from CMYK object
, the values of the object's cyan
, magenta
, yellow
, and key
properties may be numbers, strings, or any object that implements a valueOf
interface (such as an instance of a Uize.Class
subclass that implements the value
state property).
The values will be coerced to number type by invoking the valueOf Intrinsic Method
.
EXAMPLES
{cyan:0,magenta:100,yellow:0,key:0} // fuchsia {cyan:'0',magenta:'100',yellow:'0',key:'0'} // fuchsia {cyan:cyanSlider,magenta:magentaSlider,yellow:yellowSlider,key:keySlider}
NOTES
string values for the properties of the object may not contain a "%" (percent) suffix |
2.3. CMYK string
A Cmyk(...)
formatted 4-tuple string (e.g. the color chartreuse is encoded as 'cmyk(50%,0%,100%,0%)'
).
SYNTAX
cmyk([cyan0to100]%,[magenta0to100]%,[yellow0to100]%,[key0to100]%)
2.3.1. Encoding
When a color is encoded as CMYK string
, the resulting string will always be all lowercase, without any spaces.
Furthermore, the values for cyan, magenta, yellow, and key components of the tuple will be rounded to the nearest integer and constrained to a range of 0
to 100
, with a "%" (percent symbol) character appended to each.
EXAMPLES | |
COLOR NAME | CMYK string |
fuchsia | cmyk(0%,100%,0%,0%) |
yellow | cmyk(0%,0%,100%,0%) |
blue | cmyk(100%,100%,0%,0%) |
white | cmyk(0%,0%,0%,0%) |
NOTES
because encoding as CMYK string rounds the values for all four components of a color, colors encoded as CMYK string may not produce exactly the same original color when decoding the encoded CMYK string
|
2.3.2. Decoding
When a color is decoded from CMYK string
, the string may contain separating spaces, may be in upper, lower, or mixed case (i.e. not case sensitive), and the "%" (percent symbol) character for the saturation and value values may be omitted.
FUCHSIA
cmyk(0,100,0,0) cmyk(0%,100%,0%,0%) CMYK(0%,100%,0%,0%) Cmyk (0%, 100%, 0%, 0%) CMYK ( 0% , 100% , 0% , 0% ) Cmyk ( 0 , 100 , 0 , 0 )