Color¶
- class pyto_ui.Color(py_color)¶
A
Colorobject represents a color to be displayed on screen.Example:
import pyto_ui as ui # RGB black = ui.Color.rgb(0, 0, 0, 1) # White white = ui.Color.white(1, 1) # Dynamic background = ui.Color.dynamic(light=white, dark=black)
For pre-defined colors, see
SystemColors.- alpha() float¶
Returns the alpha value of the color.
- Return type:
float
- blue() float¶
Returns the blue value of the color.
- Return type:
float
- classmethod dynamic(light: Color, dark: Color) Color¶
Initializes and returns a color that dynamically changes in dark or light mode.
- green() float¶
Returns the green value of the color.
- Return type:
float
- red() float¶
Returns the red value of the color.
- Return type:
float
- classmethod rgb(red: float, green: float, blue, alpha: float = 1) Color¶
Initializes a color from RGB values.
All values should be located between 0 and 1, not between 0 and 255.
- Parameters:
red – The red value.
green – The geen value.
blue – The blue value.
alpha – The opacity value.
- Return type:
pyto_ui.Color