prolint.config.colors
Color configuration and utilities.
This module provides color schemes, amino acid colors, and color
interpolation functions for ProLint visualizations.
Functions
load_theme(→ Dict)
|
Load the ProLint color theme from JSON file. |
hex_to_rgb(→ Tuple[int, int, int])
|
Convert hex color string to RGB tuple. |
color_to_tuple(→ Tuple[float, float, float, float])
|
Convert color dict to RGBA tuple. |
interpolate_gradient(→ Tuple[float, float, float, float])
|
Interpolate a color from a gradient based on value. |
get_color_for_value(→ str)
|
Get a hex color for a value from a discrete color scale. |
get_unit_label(→ str)
|
Get display label for a time unit. |
Module Contents
-
prolint.config.colors.load_theme() → Dict[source]
Load the ProLint color theme from JSON file.
- Returns:
Theme configuration containing colors, gradients, and amino acid mappings.
- Return type:
dict
-
prolint.config.colors.COLORS: Dict[source]
-
prolint.config.colors.COLOR_SCALES: Dict[str, List[str]][source]
-
prolint.config.colors.GRADIENTS: Dict[source]
-
prolint.config.colors.AMINO_ACID_COLORS: Dict[str, str][source]
-
prolint.config.colors.AMINO_ACID_ONE_LETTER: Dict[str, str][source]
-
prolint.config.colors.UNIT_LABELS: Dict[str, str][source]
-
prolint.config.colors.hex_to_rgb(hex_color: str) → Tuple[int, int, int][source]
Convert hex color string to RGB tuple.
- Parameters:
hex_color (str) – Hex color string (e.g., “#FF5733” or “FF5733”).
- Returns:
RGB values as (red, green, blue), each 0-255.
- Return type:
tuple of int
-
prolint.config.colors.color_to_tuple(color: Dict, normalize: bool = True) → Tuple[float, float, float, float][source]
Convert color dict to RGBA tuple.
- Parameters:
color (dict) – Color dict with “r”, “g”, “b”, “a” keys (RGB in 0-255, alpha in 0-1).
normalize (bool, default=True) – If True, normalize RGB values to 0-1 range. Alpha is unchanged.
- Returns:
RGBA values as (red, green, blue, alpha).
- Return type:
tuple of float
-
prolint.config.colors.interpolate_gradient(value: float, min_val: float, max_val: float, gradient_name: str = 'sharedContacts') → Tuple[float, float, float, float][source]
Interpolate a color from a gradient based on value.
- Parameters:
value (float) – Value to map to a color.
min_val (float) – Minimum value of the range.
max_val (float) – Maximum value of the range.
gradient_name (str, default="sharedContacts") – Name of the gradient to use from GRADIENTS.
- Returns:
Interpolated RGBA color values (0-1 range).
- Return type:
tuple of float
-
prolint.config.colors.get_color_for_value(value: float, scale_name: str = 'prolint', vmin: float = 0, vmax: float = 1) → str[source]
Get a hex color for a value from a discrete color scale.
- Parameters:
value (float) – Value to map to a color.
scale_name (str, default="prolint") – Name of the color scale from COLOR_SCALES.
vmin (float, default=0) – Minimum value of the range.
vmax (float, default=1) – Maximum value of the range.
- Returns:
Hex color string.
- Return type:
str
-
prolint.config.colors.get_unit_label(unit: str) → str[source]
Get display label for a time unit.
- Parameters:
unit (str) – Time unit code (e.g., “us”, “ns”, “ps”).
- Returns:
Human-readable unit label (e.g., “μs”, “ns”, “ps”).
- Return type:
str