alphapepttools.pl.BaseColors#

class alphapepttools.pl.BaseColors#

Default color palette for alphapepttools plots

Provides access to a curated set of default colors optimized for data visualization. Colors are derived from the base qualitative colorscale with additional utility colors (grey, black, white).

Attributes table#

Methods table#

get(color_name[, lighten, alpha])

Retrieve a color by name with optional lightness and alpha adjustments

Attributes#

BaseColors.default_colors: ClassVar[dict] = {'black': (0.0, 0.0, 0.0, 1.0), 'blue': (np.float64(0.21299500192233756), np.float64(0.5114186851211072), np.float64(0.730795847750865), np.float64(1.0)), 'green': (np.float64(0.3600153787004998), np.float64(0.7161860822760476), np.float64(0.6655132641291811), np.float64(1.0)), 'grey': (0.8274509803921568, 0.8274509803921568, 0.8274509803921568, 1.0), 'lightblue': (np.float64(0.42750951317466845), np.float64(0.6612885093204082), np.float64(0.8331440815965734), np.float64(1.0)), 'lightgreen': (np.float64(0.5910034602076126), np.float64(0.835524798154556), np.float64(0.6442906574394464), np.float64(1.0)), 'lightorange': (np.float64(0.9817762399077278), np.float64(0.6073817762399076), np.float64(0.3457900807381776), np.float64(1.0)), 'lightred': (np.float64(0.8513187235678585), np.float64(0.3757477893118031), np.float64(0.44384467512495146), np.float64(1.0)), 'orange': (np.float64(0.9330257593233372), np.float64(0.3913110342176086), np.float64(0.27197231833910035), np.float64(1.0)), 'red': (np.float64(0.6196078431372549), np.float64(0.00392156862745098), np.float64(0.25882352941176473), np.float64(1.0)), 'white': (1.0, 1.0, 1.0, 1.0), 'yellow': (np.float64(0.9964628988850441), np.float64(0.8903498654363707), np.float64(0.31410995770857375), np.float64(1.0))}#

Methods#

classmethod BaseColors.get(color_name, lighten=None, alpha=None)#

Retrieve a color by name with optional lightness and alpha adjustments

Retrieves colors from the default color palette, matplotlib named colors, or passes through RGBA tuples. Optionally adjusts lightness and alpha transparency.

Parameters:
  • color_name (str | tuple) – Name of color from default_colors, matplotlib color name, or RGBA tuple.

  • lighten (float, optional) – Lightness adjustment factor. Positive values lighten, negative darken.

  • alpha (float, optional) – Alpha transparency value in range [0, 1].

Return type:

tuple

Returns:

tuple RGBA color tuple with values in range [0, 1].

Examples

Get a default color:

from alphapepttools.pl.colors import BaseColors

red_color = BaseColors.get("red")
# Returns RGBA tuple for red

Get a lightened color:

light_blue = BaseColors.get("blue", lighten=0.3)
# Returns lightened version of blue

Get a color with custom alpha:

transparent_red = BaseColors.get("red", alpha=0.5)
# Returns red with 50% transparency

Use matplotlib color names:

color = BaseColors.get("coral")
# Retrieves matplotlib's coral color