Skip to content

hkb_editor.gui.style

get_contrast_color module-attribute

get_contrast_color: Callable[[], tuple[int, int, int]] = HighContrastColorGenerator()

A global instance to generate sequences of visually distinct colors.

HighContrastColorGenerator

Generates RGB colors with a certain distance apart so that subsequent colors are visually distinct.

__call__

__call__(key: Any = None) -> tuple[int, int, int]

Allows calling the instance directly to get the next color.

__iter__

__iter__()

Allows the class to be used as an iterable.

__next__

__next__() -> tuple[int, int, int]

Generates the next high-contrast color.

colorshift

colorshift(image: ndarray, hue_shift: float = 0.0, saturation_scale: float = 1.0, value_scale: float = 1.0)

Colorshift an RGBA image in place by adjusting hue, saturation, and value.

Parameters:

image : np.ndarray RGBA image as float32 array with shape (H, W, 4) and values in [0, 1] hue_shift : float Hue rotation in range [0, 1] (e.g., 0.5 shifts by 180 degrees) saturation_scale : float Saturation multiplier (e.g., 1.5 increases saturation by 50%) value_scale : float Value/brightness multiplier

Returns:

np.ndarray Colorshifted RGBA image