color_tools.config

Thread-safe runtime configuration for color processing behavior.

Unlike ColorConstants (which are immutable scientific values), these are user preferences that can be changed and may differ per thread.

class color_tools.config.ColorConfig[source]

Bases: _local

Thread-safe runtime configuration for color processing behavior.

Unlike ColorConstants (which are immutable scientific values), these are user preferences that can be changed and may differ per thread. Uses threading.local() so each thread gets its own independent config.

__init__()[source]
color_tools.config.set_dual_color_mode(mode)[source]

Set the global dual-color handling mode for filaments with multiple hex colors.

Parameters:

mode (str) – One of “first”, “last”, or “mix” - “first”: Use the first color (default) - “last”: Use the second color - “mix”: Perceptually blend both colors in LAB space

Raises:

ValueError – If mode is not one of the valid options

Return type:

None

color_tools.config.get_dual_color_mode()[source]

Get the current dual-color handling mode.

Return type:

str

color_tools.config.set_gamut_tolerance(tolerance)[source]

Set the tolerance for gamut boundary checking.

Parameters:

tolerance (float)

Return type:

None

color_tools.config.get_gamut_tolerance()[source]

Get the current gamut tolerance.

Return type:

float

color_tools.config.set_gamut_max_iterations(iterations)[source]

Set the maximum iterations for gamut mapping binary search.

Parameters:

iterations (int)

Return type:

None

color_tools.config.get_gamut_max_iterations()[source]

Get the current gamut max iterations.

Return type:

int