sign_language_translator.config.colors module
- class sign_language_translator.config.colors.Colors(BLACK: Tuple[int, int, int] = (0, 0, 0), NAVY_BLUE: Tuple[int, int, int] = (0, 0, 255), GREEN: Tuple[int, int, int] = (0, 255, 0), RED: Tuple[int, int, int] = (255, 0, 0), CYAN: Tuple[int, int, int] = (0, 255, 255), MAGENTA: Tuple[int, int, int] = (255, 0, 255), YELLOW: Tuple[int, int, int] = (255, 255, 0), ORANGE: Tuple[int, int, int] = (255, 127, 0), PURPLE: Tuple[int, int, int] = (127, 0, 255), PINK: Tuple[int, int, int] = (255, 127, 255), HOT_PINK: Tuple[int, int, int] = (255, 0, 127), BLUE: Tuple[int, int, int] = (0, 127, 255), LEAF_GREEN: Tuple[int, int, int] = (127, 255, 0), DARK_GREY: Tuple[int, int, int] = (63, 63, 63), GREY: Tuple[int, int, int] = (127, 127, 127), LIGHT_GREY: Tuple[int, int, int] = (191, 191, 191))[source][source]
Bases:
objectA class to represent a set of predefined colors and provide utility functions related to colors.
- static gradient(n: int, colors: ~typing.Sequence[~typing.Tuple[float | int, float | int, float | int]] = ((255, 0, 127), (0, 127, 255), (255, 0, 127)), endpoint=False, dtype=<class 'int'>) List[Tuple[float, float, float]][source][source]
Generate a gradient of colors by linearly interpolating between a sequence of colors.
- Parameters:
n (int) – The number of colors to generate in the gradient.
colors (Sequence[Tuple[Union[float, int], Union[float, int], Union[float, int]]], optional) – A sequence of RGB tuples to interpolate between. Defaults to (HOT_PINK, BLUE, HOT_PINK).
endpoint (bool, optional) – If True, the last value in the colors sequence is included. Defaults to False.
dtype (Union[type, str], optional) – The desired data type of the output colors. Defaults to int.
- Returns:
A list of RGB tuples representing the gradient.
- Return type:
List[Tuple[float, float, float]]
Example
>>> Colors.gradient(5, colors = [(128, 0, 0), (0, 0, 128)], endpoint=True) [[128, 0, 0], [96, 0, 32], [64, 0, 64], [32, 0, 96], [0, 0, 128]]