Skip to content

colors

Color utilities and background constants for VisFEM.

css_rgb

css_rgb(rgb)

Return the CSS rgb() string for unit-range tuple rgb, each channel rounded to 0 to 255.

scheme_to_hex

scheme_to_hex(scheme_id)

Return the colors of PyVista color scheme scheme_id as '#rrggbb' strings.

region_colors

region_colors(n, palette)

Return n colors cycled from palette.

is_valid_hex

is_valid_hex(color)

Return True when color is a '#rrggbb' string a VTK lookup table accepts.

category_key

category_key(item)

Return the override key for item: its first display name (region label, organ filename or part label).

apply_color_overrides

apply_color_overrides(legend_items, overrides)

Apply overrides to legend_items; return the recolored items and their LUT colors in item order.

color_scope

color_scope(state)

Return the override scope key for the current scene.

active_overrides

active_overrides(state)

Return a dict of category -> hex overrides for the current scope.

set_override

set_override(state, name, color)

Set the override for category name to color in the current scope; None clears it.

clear_overrides

clear_overrides(state)

Drop every override in the current scope.

apply_overrides_to_state

apply_overrides_to_state(state, legend_items)

Write legend_items to state with overrides applied; return the LUT colors.