Namespace one.color.CMYK
A color in the CMYK colorspace, with an optional alpha value.
one.color.(RGB|HSL|HSV|CMYK) objects are designed to be immutable; all the conversion, set, and adjust methods return new objects.
one.color.(RGB|HSL|HSV|CMYK) objects automatically get the set and adjust methods from all other installed colorspaces, so although you can use the explicit conversion methods (one.color.CMYK#toRGB, one.color.CMYK#toHSL...), the below will work just fine:
one.include('jslib:one/color/CMYK.js');
one.include('jslib:one/color/RGB.js');
one.include('jslib:one/color/HSL.js');
new one.color.CMYK(.4, .2, .4, .9, .2). // CMYK with alpha
setBlue(-.2). // Implicit conversion to RGB (with alpha)
adjustHue(-.1). // Implicit conversion to HSL(/HSV) (with alpha)
toCSSWithAlpha(); // "rgba(20,13,0,0.2)"
Defined in: CMYK.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Field Attributes | Field Name and Description |
|---|---|
|
The alpha value, range: [0.
|
|
|
The cyan component, range: [0.
|
|
|
The black component, range: [0.
|
|
|
The magenta component, range: [0.
|
|
|
The yellow component, range: [0.
|
| Method Attributes | Method Name and Description |
|---|---|
|
adjustAlpha(a)
|
|
|
adjustBlack(k)
|
|
|
adjustCyan(c)
|
|
|
adjustYellow(y)
|
|
|
setAlpha(a)
|
|
|
setBlack(k)
|
|
|
setCyan(c)
|
|
|
setMagenta(m)
|
|
|
setYellow(y)
|
|
|
toCMYK()
Convert the color to a one.color.CMYK object, ie.
|
|
|
toCSS()
Get a valid CSS color representation of the color without an alpha value.
|
|
|
Get a valid CSS color representation of the color, including the alpha value.
|
|
|
toHex()
Get the standard RGB hex representation of the color.
|
|
|
toHSL()
Convert the color to a one.color.HSL object.
|
|
|
toHSV()
Convert the color to a one.color.HSV object.
|
|
|
toJSON()
Convert the color to a JSON representation.
|
|
|
toRGB()
Convert the color to a one.color.RGB object.
|
Namespace Detail
one.color.CMYK
- Parameters:
- {Number} c
- The cyan component, range: [0..1]
- {Number} m
- The magenta component, range: [0..1]
- {Number} y
- The yellow component, range: [0..1]
- {Number} k
- The black component, range: [0..1]
- {Number} a Optional
- The alpha value, range: [0..1], defaults to 1
Field Detail
{Number}
a
The alpha value, range: [0..1]
{Number}
c
The cyan component, range: [0..1]
{Number}
k
The black component, range: [0..1]
{Number}
m
The magenta component, range: [0..1]
{Number}
y
The yellow component, range: [0..1]
Method Detail
{one.color.CMYK}
adjustAlpha(a)
- Parameters:
- {Number} a
- The value to add to the alpha value. If the resulting value falls outside the supported range, [0..1], it will be adjusted automatically.
- Returns:
- {one.color.CMYK} New color object with the changed value.
{one.color.CMYK}
adjustBlack(k)
- Parameters:
- {Number} k
- The value to add to the black component. If the resulting value falls outside the supported range, [0..1], it will be adjusted automatically.
- Returns:
- {one.color.CMYK} New color object with the changed value.
{one.color.CMYK}
adjustCyan(c)
- Parameters:
- {Number} c
- The value to add to the cyan component. If the resulting value falls outside the supported range, [0..1], it will be adjusted automatically.
- Returns:
- {one.color.CMYK} New color object with the changed value.
{one.color.CMYK}
adjustMagenta(m)
- Parameters:
- {Number} m
- The value to add to the magenta component. If the resulting value falls outside the supported range, [0..1], it will be adjusted automatically.
- Returns:
- {one.color.CMYK} New color object with the changed value.
{one.color.CMYK}
adjustYellow(y)
- Parameters:
- {Number} y
- The value to add to the yellow component. If the resulting value falls outside the supported range, [0..1], it will be adjusted automatically.
- Returns:
- {one.color.CMYK} New color object with the changed value.
{one.color.CMYK}
setAlpha(a)
- Parameters:
- {Number} a
- The new alpha value, range: [0..1]
- Returns:
- {one.color.CMYK} New color object with the changed value.
{one.color.CMYK}
setBlack(k)
- Parameters:
- {Number} k
- The new black component, range: [0..1]
- Returns:
- {one.color.CMYK} New color object with the changed value.
{one.color.CMYK}
setCyan(c)
- Parameters:
- {Number} c
- The new cyan component, range: [0..1]
- Returns:
- {one.color.CMYK} New color object with the changed value.
{one.color.CMYK}
setMagenta(m)
- Parameters:
- {Number} m
- The new magenta component, range: [0..1]
- Returns:
- {one.color.CMYK} New color object with the changed value.
{one.color.CMYK}
setYellow(y)
- Parameters:
- {Number} y
- The new yellow component, range: [0..1]
- Returns:
- {one.color.CMYK} New color object with the changed value.
{one.color.CMYK}
toCMYK()
Convert the color to a one.color.CMYK object, ie. return the object itself.
- Returns:
- {one.color.CMYK}
{String}
toCSS()
Get a valid CSS color representation of the color without an alpha value.
- Returns:
- {String} The CSS color string, e.g. "rgb(123, 2, 202)"
{String}
toCSSWithAlpha()
Get a valid CSS color representation of the color, including the alpha value.
- Returns:
- {String} The CSS color string, e.g. "rgba(123, 2, 202, 0.253)"
{String}
toHex()
Get the standard RGB hex representation of the color.
- Returns:
- {String} The hex string, e.g. "#f681df"
{one.color.HSL}
toHSL()
Convert the color to a one.color.HSL object.
- Returns:
- {one.color.HSL}
- Requires:
- one.color.HSL
{one.color.HSV}
toHSV()
Convert the color to a one.color.HSV object.
- Returns:
- {one.color.HSV}
- Requires:
- one.color.HSV
{Array}
toJSON()
Convert the color to a JSON representation.
- Returns:
- {Array}
{one.color.RGB}
toRGB()
Convert the color to a one.color.RGB object.
- Returns:
- {one.color.RGB}