pyqt_reactive.widgets.shared.scope_color_utils
Utilities for generating scope-based colors using distinct palettes.
Functions
|
Build color scheme for a given base RGB and scope_id. |
|
Extract orchestrator portion from scope_id. |
|
Extract per-orchestrator step index from scope_id. |
|
Get color scheme for scope via service. |
|
Convert HSV color to RGB tuple. |
|
Get perceptually distinct color variant using CIELAB lightness. |
- pyqt_reactive.widgets.shared.scope_color_utils.tint_color_perceptual(base_rgb: Tuple[int, int, int], tint_idx: int) → QColor[source]
Get perceptually distinct color variant using CIELAB lightness.
Uses CIELAB color space which is designed so equal distances represent equal perceived color differences (perceptual uniformity).
- pyqt_reactive.widgets.shared.scope_color_utils.extract_orchestrator_scope(scope_id: str | None) → str | None[source]
Extract orchestrator portion from scope_id.
- pyqt_reactive.widgets.shared.scope_color_utils.extract_step_index(scope_id: str) → int[source]
Extract per-orchestrator step index from scope_id.
Handles multiple token formats: - plate::step@5 → 5 (legacy @ notation) - plate::functionstep_3 → 3 (ScopeTokenService format: prefix_N) - Falls back to MD5 hash for unknown formats
- pyqt_reactive.widgets.shared.scope_color_utils.hsv_to_rgb(hue: int, saturation: int, value: int) → tuple[int, int, int][source]
Convert HSV color to RGB tuple.
- pyqt_reactive.widgets.shared.scope_color_utils.get_scope_color_scheme(scope_id: str | None, step_index: int | None = None) → ScopeColorScheme[source]
Get color scheme for scope via service.
- Parameters:
scope_id – The scope identifier (e.g., “plate_path::functionstep_0”)
step_index – Optional explicit step index (position in pipeline). If provided, overrides extraction from scope_id. Use this for list items where actual position matters.
- pyqt_reactive.widgets.shared.scope_color_utils.build_color_scheme_from_rgb(base_rgb: Tuple[int, int, int], scope_id: str, step_index: int | None = None) → ScopeColorScheme[source]
Build color scheme for a given base RGB and scope_id.
- Parameters:
base_rgb – The base color for the scope (from palette)
scope_id – The scope identifier
step_index – Optional explicit step index. If provided, uses this for border pattern calculation instead of extracting from scope_id.