bot_api.util package¶
Submodules¶
bot_api.util.color_util module¶
- class ColorUtil[source]¶
Bases:
ABC- static to_hex(color: Color | None) str | None[source]¶
Converts the specified Color object to a hex triplet string representation.
The hex triplet consists of six hexadecimal digits representing an RGB color, e.g., “0099CC”.
- Parameters:
color (Color) – The Color object to convert to a hex triplet.
- Returns:
A string representing the color as a hex triplet of six hexadecimal digits, or None if the color is None.
- Return type:
str
- static from_string(string: str | None) Color | None[source]¶
Creates a color from a string. Currently, only numeric RGB values are supported.
This method works the same as from_hex except that it requires a hash sign before the hex value. An example of a numeric RGB value is “#09C” or “#0099CC”, which both represent the same color.
- Parameters:
string (str) – A string containing either three or six hexadecimal RGB values like “#09C” or “#0099CC”.
- Returns:
The created Color object, or None if the input parameter is None.
- Return type:
- Raises:
ValueError – If the input string is not in the valid numeric RGB format.
- static from_hex(hex_triplet: str) Color[source]¶
Creates a color from a hex triplet.
A hex triplet is either three or six hexadecimal digits that represent an RGB color. An example of a hex triplet is “09C” or “0099CC”, which both represent the same color.
- Parameters:
hex_triplet (str) – A string containing either three or six hexadecimal numbers like “09C” or “0099CC”.
- Returns:
The created Color object.
- Return type:
- Raises:
ValueError – If the input string is not a valid hex triplet.
bot_api.util.country_code_util module¶
bot_api.util.math_util module¶
Module contents¶
- class ColorUtil[source]¶
Bases:
ABC- static to_hex(color: Color | None) str | None[source]¶
Converts the specified Color object to a hex triplet string representation.
The hex triplet consists of six hexadecimal digits representing an RGB color, e.g., “0099CC”.
- Parameters:
color (Color) – The Color object to convert to a hex triplet.
- Returns:
A string representing the color as a hex triplet of six hexadecimal digits, or None if the color is None.
- Return type:
str
- static from_string(string: str | None) Color | None[source]¶
Creates a color from a string. Currently, only numeric RGB values are supported.
This method works the same as from_hex except that it requires a hash sign before the hex value. An example of a numeric RGB value is “#09C” or “#0099CC”, which both represent the same color.
- Parameters:
string (str) – A string containing either three or six hexadecimal RGB values like “#09C” or “#0099CC”.
- Returns:
The created Color object, or None if the input parameter is None.
- Return type:
- Raises:
ValueError – If the input string is not in the valid numeric RGB format.
- static from_hex(hex_triplet: str) Color[source]¶
Creates a color from a hex triplet.
A hex triplet is either three or six hexadecimal digits that represent an RGB color. An example of a hex triplet is “09C” or “0099CC”, which both represent the same color.
- Parameters:
hex_triplet (str) – A string containing either three or six hexadecimal numbers like “09C” or “0099CC”.
- Returns:
The created Color object.
- Return type:
- Raises:
ValueError – If the input string is not a valid hex triplet.
- class CountryCodeUtil[source]¶
Bases:
objectCountry code utility class.