sec_interp.gui.renderers.color_manager module

Color management for geological units.

class sec_interp.gui.renderers.color_manager.ColorManager

Bases: object

Manages consistent color assignment for geological units.

GEOLOGY_COLORS: ClassVar[list[qgis.PyQt.QtGui.QColor]] = [qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor, qgis.PyQt.QtGui.QColor]
__init__() → None

Initialize the color manager.

dump() → dict[str, Any]

Serialize user overrides, hidden units, labels and order.

get_color(name: str) → qgis.PyQt.QtGui.QColor

Get a consistent color for a geological unit (honoring overrides).

hidden_units() → set[str]

Return the hidden unit names.

is_hidden(name: str) → bool

Return whether a unit is hidden.

known_units() → list[str]

Return every registered unit name, sorted.

label(name: str) → str

Return the display label for a unit (alias or the name).

labels() → dict[str, str]

Return a copy of the unit label aliases.

load(data: dict[str, Any] | None) → None

Restore user overrides, hidden units, labels and order.

move_unit(name: str, delta: int) → None

Move a unit up (-1) or down (+1) in the display order.

ordered_units() → list[str]

Return known units honoring a custom order, then the rest sorted.

overrides() → dict[str, qgis.PyQt.QtGui.QColor]

Return a copy of the current color overrides.

register_units(names: Iterable[str], source: str = 'geology') → None

Register units known to the current data (visible or hidden).

set_color(name: str, color: qgis.PyQt.QtGui.QColor) → None

Set (override) the color of a unit.

set_hidden(name: str, hidden: bool) → None

Hide or show a unit in the rendered geology.

set_label(name: str, text: str) → None

Set (or clear) a display alias for a unit.

set_order(names: Iterable[str]) → None

Set the custom display order for the given unit names.

units_for_source(source: str) → list[str]

Return the ordered unit names registered under a source.