FORGE. Color

Methods

(static) componentToHex(c) → {string}

Convert a color component into hexa value.
Parameters:
Name Type Description
c number The color component to convert.
Source:
Returns:
The convert componenet into hex string.
Type
string

(static) distance(a, b) → {number}

Evaluate euclidian distance between two colors
Parameters:
Name Type Description
a YCbCrColor 1st color in YCrCb colorspace
b YCbCrColor 2nd color in YCrCb colorspace
Source:
Returns:
distance
Type
number

(static) fromRgbaString(rgbaString) → {RGBaColor}

Convert rgba/rgb string into a four/three components object.
Parameters:
Name Type Description
rgbaString string rgba/rgb string with format rgba(r,g,b,a)/rgb(r,g,b)
Source:
Returns:
The rgb color in four/three components.
Type
RGBaColor

(static) hexToRgb(hex) → (nullable) {RGBaColor}

Convert hexadecimal color string to rgb components.
Parameters:
Name Type Description
hex string hexadecimal color string to convert.
Source:
Returns:
The rgb color in three components.
Type
RGBaColor

(static) hslToRgb(h, s, l) → {RGBaColor}

Converts an HSL color value to RGB. Conversion formula adapted from http://en.wikipedia.org/wiki/HSL_color_space.
Assumes h, s, and l are contained in the set [0, 1] and returns r, g, and b in the set [0, 255].
Parameters:
Name Type Description
h number The hue
s number The saturation
l number The lightness
Source:
Returns:
The RGB representation
Type
RGBaColor

(static) hsvToRgb(h, s, v) → {RGBaColor}

Converts an HSV color value to RGB. Conversion formula adapted from http://en.wikipedia.org/wiki/HSV_color_space.
Assumes h, s, and v are contained in the set [0, 1] and returns r, g, and b in the set [0, 255].
Parameters:
Name Type Description
h number The hue
s number The saturation
v number The value
Source:
Returns:
The RGB representation
Type
RGBaColor

(static) hueToRgb(p, q, t) → {number}

Convert hue to rgb.
Parameters:
Name Type Description
p number
q number
t number
Source:
Returns:
Type
number

(static) regbToHex(r, g, b) → {string}

Convert rgb values into a css compatible hexadecimal string.
Parameters:
Name Type Description
r number Red component.
g number Green component.
b number Blue component.
Source:
Returns:
Returns the hexadecimal string for the color.
Type
string

(static) rgbToHsl(r, g, b) → {HSLColor}

Converts an RGB color value to HSL. Conversion formula adapted from http://en.wikipedia.org/wiki/HSL_color_space.
Assumes r, g, and b are contained in the set [0, 255] and returns h, s, and l in the set [0, 1].
Parameters:
Name Type Description
r number The red color value.
g number The green color value.
b number The blue color value.
Source:
Returns:
The HSL representation.
Type
HSLColor

(static) rgbToHsv(r, g, b) → {HSVColor}

Converts an RGB color value to HSV. Conversion formula adapted from http://en.wikipedia.org/wiki/HSV_color_space. Assumes r, g, and b are contained in the set [0, 255] and returns h, s, and v in the set [0, 1].
Parameters:
Name Type Description
r number The red color value.
g number The green color value.
b number The blue color value.
Source:
Returns:
The HSV representation.
Type
HSVColor

(static) rgbToYcbcr(color) → {YCbCrColor}

Convert RGB into YCbCr color space
Parameters:
Name Type Description
color RGBaColor color in RGB space ([0 .. 255])
Source:
Returns:
color in YCrCb space (Y,Cr,Cb [0 .. 255])
Type
YCbCrColor

(static) ycbcrRotate(color, angle) → {YCbCrColor}

Rotate color in YCbCr color space
Parameters:
Name Type Description
color YCbCrColor YCbCr color
angle number rotation angle (degrees)
Source:
Returns:
YCbCr rotated color
Type
YCbCrColor

(static) ycbcrToRgb(color) → {RGBaColor}

Convert YCbCr into RGB color space
Parameters:
Name Type Description
color YCbCrColor color in YCrCb space (Y,Cr,Cb [0 .. 255])
Source:
Returns:
color in RGB space ([0 .. 255])
Type
RGBaColor

FORGE. Color

Methods