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