color#
Inicializando la clase de color#
Un color se crea utilizando uno de los siguientes constructores:
The color(r, g, b)
constructor creates a color using rgb values:
Parámetro |
Descripción |
---|---|
o |
Un número entero en el rango de 0 a 255 que representa el valor rojo. |
gramo |
Un número entero en el rango de 0 a 255 que representa el valor verde. |
b |
Un número entero en el rango de 0 a 255 que representa el valor azul. |
// Construct a yellow color "Yellow" with the color class
// using rgb values.
color Yellow = color(255, 247, 0);
The color(value)
constructor creates a color using rgb values:
Parámetro |
Descripción |
---|---|
valor |
Un valor de código hexadecimal o un colorType predefinido. |
// Construct a yellow Color "yellow" with the Color class
// using a Hexcode.
color Yellow = color(0xFFF700);
// Construct a yellow Color "yellow" with the Color class
// using a predefined color.
color Yellow = color(yellow);
This Yellow
object will be used in all subsequent examples throughout this API documentation when referring to Color class methods.
Métodos de clase#
hsv()#
The hsv(hue, saturation, value)
method changes the existing color instance using hsv.
Parámetros |
Descripción |
---|---|
matiz |
Un número entero de 0 a 360 que representa el tono del color. |
saturación |
Un doble de 0.0 – 1.0 que representa la saturación del color. |
valor |
Un doble de 0.0 – 1.0 que representa el brillo del color. |
Devuelve: Un valor entero que representa el color.
// Change Yellow to a color that is red using HSV values.
Yellow.hsv(0, 1.0, 1.0);
web()#
The web(value)
method changes the existing color instance using webstring.
Parámetros |
Descripción |
---|---|
valor |
El valor del color en formato web. |
Devuelve: Un valor entero que representa el color.
// Change Yellow to a color that is red using a Hexcode.
Yellow.web("#ff0000");
isTransparent()#
The isTransparent()
method returns if the color is transparent or not.
Returns: true
if the color is transparent. false
if it is not.
hue()#
The hue()
method returns the hue of the color.
Devuelve: El tono del color en el rango de 0 a 360 grados.
saturation()#
The saturation()
method returns the saturation of the color.
Devuelve: La saturación del color en el rango 0 – 1.0.
brightness()#
The brightness()
method returns the brightness of the color.
Devuelve: El brillo del color en el rango 0 - 1.0.