Color#
Inicializando la clase de color#
Un color se crea utilizando el siguiente constructor:
Color(value)
Este constructor utiliza un parámetro:
Parámetro |
Descripción |
---|---|
|
El valor del color. Se puede especificar de cuatro maneras diferentes:
|
Construyendo con un valor hexadecimal.
# Construct a yellow Color "yellow" with the Color class.
yellow = Color(0xfff700)
Construyendo con valores RGB.
# Construct a yellow Color "yellow" with the Color class.
yellow = Color(255, 247, 0)
Construyendo con una cuerda web.
# Construct a yellow Color "yellow" with the Color class.
yellow = Color("#fff700")
Construir con un tipo de color existente.
# Construct a yellow Color "yellow" with the Color class.
yellow = Color(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#
rgb()#
The rgb(value)
method changes the existing color instance using RGB values.
Parámetros |
Descripción |
---|---|
valor |
El valor de color que se cambiará a un valor rgb. |
Devuelve: Un valor entero que representa el color.
# Change "yellow" to a different color using RGB values.
yellow.rgb(255, 200, 0)
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 a 1.0 que representa la saturación del color. |
valor |
Un doble de 0.0 a 1.0 que representa el brillo del color. |
Devuelve: Un valor entero que representa el color.
# Change yellow to a different color using HSV values.
color.hsv(47, 1, 1)
web()#
The web(value)
method changes the existing color instance using a 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 different color using a webstring value.
yellow.web("#ffc800")
is_transparent()#
The is_transparent()
method returns if the color is transparent or not.
Returns: True
if the color is transparent. False
if it is not.