color¶
Functions
|
Generate new color which oppositely by exist colors. |
|
|
|
Convert HEX RGB string to integer RGB format. |
Generate RGB color with fixed saturation and lightness. |
|
|
Convert integer color format to HEX string. |
|
Generates ValueError if value not between 0 and 255. |
Description
- generate_rgb(exist_colors)[source]¶
Generate new color which oppositely by exist colors.
- Parameters
- exist_colors : list
List of existing colors in RGB format.
- Returns
RGB integer values
- Return type
List[int, int, int]
- Usage example
import supervisely as sly exist_colors = [[0, 0, 0], [128, 64, 255]] color = sly.color.generate_rgb(exist_colors) print(color) # Output: [15, 138, 39]
- hex2rgb(hex_value)[source]¶
Convert HEX RGB string to integer RGB format.
- Parameters
- hex_value : str
HEX RGB string.
- Returns
RGB integer values
- Return type
List[int, int, int]
- Usage example
import supervisely as sly hex_color = '#8040FF' color = sly.color.hex2rgb(hex_color) print(color) # Output: [128, 64, 255]
- random_rgb()[source]¶
Generate RGB color with fixed saturation and lightness.
- Returns
RGB integer values
- Return type
List[int, int, int]
- Usage example
import supervisely as sly color = sly.color.random_rgb() print(color) # Output: [138, 15, 123]
- validate_channel_value(value)[source]¶
Generates ValueError if value not between 0 and 255.
- Parameters
- value : int
Input channel value.
- Raises
ValueError
if value not between 0 and 255.- Returns
None
- Return type
NoneType