func_sketch._impl.color_util module

func_sketch._impl.color_util module#

Utilities of colors.

func_sketch._impl.color_util.hex_to_rgb_color(hex: str) RGBColor#

Convert a hex color string to an RGBColor object.

Parameters:

hex – Hex color string without alpha channel (e.g., “#RRGGBB”).

Returns:

RGBColor object.

func_sketch._impl.color_util.hex_to_rgba(hex: str) tuple[float, float, float, float]#

Convert a hex color string to an RGBA tuple.

Parameters:

hex – Hex color string (e.g., “#RRGGBB” or “#RRGGBBAA”).

Returns:

RGBA tuple with values in the range [0.0, 1.0].

func_sketch._impl.color_util.rgba_to_rgb_color(rgba: tuple[float, float, float, float]) RGBColor#

Convert an RGBA tuple to an RGBColor object.

Parameters:

rgba – RGBA tuple with values in the range [0.0, 1.0].

Returns:

RGBColor object.