Class pv.Color.Rgb
Extends
pv.Color.
Represents a color in RGB space.
Defined in: Color.js.
Constructor Attributes | Constructor Name and Description |
---|---|
pv.Color.Rgb(r, g, b, a)
Constructs a new RGB color with the specified channel values.
|
Field Attributes | Field Name and Description |
---|---|
The alpha channel, a float in [0, 1].
|
|
The blue channel, an integer in [0, 255].
|
|
The green channel, an integer in [0, 255].
|
|
The red channel, an integer in [0, 255].
|
Method Attributes | Method Name and Description |
---|---|
alpha(a)
Constructs a new RGB color with the same red, green and blue channels as this
color, with the specified alpha channel.
|
|
blue(b)
Constructs a new RGB color with the same red, green and alpha channels as
this color, with the specified blue channel.
|
|
brighter(k)
Returns a new color that is a brighter version of this color.
|
|
darker(k)
Returns a new color that is a darker version of this color.
|
|
green(g)
Constructs a new RGB color with the same red, blue and alpha channels as this
color, with the specified green channel.
|
|
red(r)
Constructs a new RGB color with the same green, blue and alpha channels as
this color, with the specified red channel.
|
|
rgb()
Returns this.
|
Class Detail
pv.Color.Rgb(r, g, b, a)
Constructs a new RGB color with the specified channel values.
- Parameters:
- {number} r
- the red channel, an integer in [0,255].
- {number} g
- the green channel, an integer in [0,255].
- {number} b
- the blue channel, an integer in [0,255].
- {number} a
- the alpha channel, a float in [0,1].
Field Detail
{number}
a
The alpha channel, a float in [0, 1].
{number}
b
The blue channel, an integer in [0, 255].
{number}
g
The green channel, an integer in [0, 255].
{number}
r
The red channel, an integer in [0, 255].
Method Detail
alpha(a)
Constructs a new RGB color with the same red, green and blue channels as this
color, with the specified alpha channel.
- Parameters:
- {number} a
- the alpha channel, a float in [0,1].
blue(b)
Constructs a new RGB color with the same red, green and alpha channels as
this color, with the specified blue channel.
- Parameters:
- {number} b
- the blue channel, an integer in [0,255].
{pv.Color.Rgb}
brighter(k)
Returns a new color that is a brighter version of this color. This method
applies an arbitrary scale factor to each of the three RGB components of this
color to create a brighter version of this color. Although brighter and
darker are inverse operations, the results of a series of invocations of
these two methods might be inconsistent because of rounding errors.
- Parameters:
- k Optional
- {number} an optional scale factor; defaults to 1.
- Returns:
- {pv.Color.Rgb} a brighter color.
- See:
- #darker
{pv.Color.Rgb}
darker(k)
Returns a new color that is a darker version of this color. This method
applies an arbitrary scale factor to each of the three RGB components of this
color to create a darker version of this color. Although brighter and darker
are inverse operations, the results of a series of invocations of these two
methods might be inconsistent because of rounding errors.
- Parameters:
- k Optional
- {number} an optional scale factor; defaults to 1.
- Returns:
- {pv.Color.Rgb} a darker color.
- See:
- #brighter
green(g)
Constructs a new RGB color with the same red, blue and alpha channels as this
color, with the specified green channel.
- Parameters:
- {number} g
- the green channel, an integer in [0,255].
red(r)
Constructs a new RGB color with the same green, blue and alpha channels as
this color, with the specified red channel.
- Parameters:
- {number} r
- the red channel, an integer in [0,255].
{pv.Color.Rgb}
rgb()
Returns this.
- Returns:
- {pv.Color.Rgb} this.