Class: ColorHSBA

SolidML.ColorHSBA(hopt, sopt, bopt, aopt)

Keep color infomations as (hue, saturation, brightness, alpha)

Constructor

new ColorHSBA(hopt, sopt, bopt, aopt)

Parameters:
Name Type Attributes Default Description
h number <optional>
0 hue in degree (0-360)
s number <optional>
0 satulation between 0 and 1
b number <optional>
0 brightness between 0 and 1
a number <optional>
1 alpha between 0 and 1
Source:

Members

a :number

alpha between 0 and 1
Type:
  • number
Source:

b :number

brightness between 0 and 1
Type:
  • number
Source:

cp :SolidML.ColorPool

colorpool scheme for random generation, null for constant value
Type:
Source:

h :number

hue in degree (0-360)
Type:
  • number
Source:

s :number

satulation between 0 and 1
Type:
  • number
Source:

Methods

blend(dst, ratio) → {SolidML.ColorHSBA}

blend color with another SolidML.ColorHSBA
Parameters:
Name Type Description
dst SolidML.ColorHSBA color to blend with
ratio number blending ratio
Source:
Returns:
this instance
Type
SolidML.ColorHSBA

clone() → {SolidML.ColorHSBA}

create clone
Source:
Returns:
new instance
Type
SolidML.ColorHSBA

copy(c) → {SolidML.ColorHSBA}

copy from
Parameters:
Name Type Description
c SolidML.ColorHSBA source color copy from
Source:
Returns:
this instance
Type
SolidML.ColorHSBA

getRGBA() → {object}

get color as {r,g,b,a}
Source:
Returns:
object has keys {r,g,b,a}.
Type
object

multiply(c) → {SolidML.ColorHSBA}

update color by another color
Parameters:
Name Type Description
c SolidML.ColorHSBA color to multiply
Source:
Returns:
this instance
Type
SolidML.ColorHSBA

set(h, s, b, a) → {SolidML.ColorHSBA}

set
Parameters:
Name Type Description
h number hue in degree (0-360)
s number satulation between 0 and 1
b number brightness between 0 and 1
a number alpha between 0 and 1
Source:
Returns:
this instance
Type
SolidML.ColorHSBA

setColorPool(colorpoolInstance)

set random color generator
Parameters:
Name Type Description
colorpoolInstance SolidML.ColorPool colorpool instance to generate random color
Source:

setHex(hexString) → {SolidML.ColorHSBA}

set color by "#HEX" string
Parameters:
Name Type Description
hexString string color string stating with "#" and 3 or 6 hex.
Source:
Returns:
this instance
Type
SolidML.ColorHSBA

setRGB(col) → {SolidML.ColorHSBA}

set color by {r,g,b}
Parameters:
Name Type Description
col object object that has keys {r, g, b}
Source:
Returns:
this instance
Type
SolidML.ColorHSBA