euporie.core.style

Style related functions.

Functions

build_style(cp[, have_term_colors])

Create an application style based on the given color palette.

default_ui_style()

Create a default Style object.

hls_to_rgb(h, l, s)

rgb_to_hls(r, g, b)

Classes

ColorPalette()

Define a collection of colors.

ColorPaletteColor(base[, _base_override])

A representation of a color with adjustment methods.

SimpleCache([maxsize])

Very simple cache that discards the oldest item when the cache size is exceeded.

Style(style_rules)

Create a Style instance from a list of style rules.

partial

partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.

class euporie.core.style.ColorPalette

Bases: object

Define a collection of colors.

add_color(name: str, base: str, _base_override: str = '') euporie.core.style.ColorPalette

Add a color to the palette.

class euporie.core.style.ColorPaletteColor(base: str, _base_override: str = '')

Bases: object

A representation of a color with adjustment methods.

adjust(hue: float = 0.0, brightness: float = 0.0, saturation: float = 0.0, rel: bool = True) euporie.core.style.ColorPaletteColor

Adjust the hue, saturation, or brightness of the color.

Parameters
  • hue – The hue adjustment.

  • brightness – The brightness adjustment.

  • saturation – The saturation adjustment.

  • rel – If True, perform a relative adjustment.

Returns

The adjusted color.

Return type

ColorPaletteColor

darker(amount: float, rel: bool = True) euporie.core.style.ColorPaletteColor

Make the color darker.

Parameters
  • amount – The amount to darken the color by.

  • rel – If True, perform a relative adjustment.

Returns

The darker color.

Return type

ColorPaletteColor

less(amount: float, rel: bool = True) euporie.core.style.ColorPaletteColor

Make bright colors brighter and dark colors darker.

Parameters
  • amount – The amount to adjust the color by.

  • rel – If True, perform a relative adjustment.

Returns

The adjusted color.

Return type

ColorPaletteColor

lighter(amount: float, rel: bool = True) euporie.core.style.ColorPaletteColor

Make the color lighter.

Parameters
  • amount – The amount to lighten the color by.

  • rel – If True, perform a relative adjustment.

Returns

The lighter color.

Return type

ColorPaletteColor

more(amount: float, rel: bool = True) euporie.core.style.ColorPaletteColor

Make bright colors darker and dark colors brighter.

Parameters
  • amount – The amount to adjust the color by.

  • rel – If True, perform a relative adjustment.

Returns

The adjusted color.

Return type

ColorPaletteColor

towards(other: euporie.core.style.ColorPaletteColor, amount: float) euporie.core.style.ColorPaletteColor

Interpolate between two colors.

euporie.core.style.build_style(cp: euporie.core.style.ColorPalette, have_term_colors: bool = True) prompt_toolkit.styles.style.Style

Create an application style based on the given color palette.