otx.api.entities.color#
This module define the color entity.
Classes
|
Represents an RGBA color. |
|
This class represents an abstract Color, some functions are still abstract. |
- class otx.api.entities.color.Color(red: int, green: int, blue: int, alpha: int = 255)[source]#
Bases:
ColorEntity
Represents an RGBA color.
- classmethod from_hex_str(string: str) Color [source]#
Creates Color() instance given a hex string.
Supports 6 character hex string (RGB), or 8 character hex string (RGBA). The string might optionally start with a number sign (#).
Example
Creating color object:
>>> Color.from_hex_str("#ff0000") Color(red=255, green=0, blue=0, alpha=255)
>>> Color.from_hex_str("0000ff") Color(red=0, green=0, blue=255, alpha=255)
>>> Color.from_hex_str("#96Ff00C8") Color(red=150, green=255, blue=0, alpha=200)
- Parameters:
string (str) – Hex string
- Returns:
Color instance
- classmethod random() Color [source]#
Generate random Color() instance.
- Returns:
Color instance with random color
- class otx.api.entities.color.ColorEntity(red: int, green: int, blue: int, alpha: int)[source]#
Bases:
object
This class represents an abstract Color, some functions are still abstract.