Theme#

Theme class#

class gufo.style.theme.Theme(name, rc)[source]#

Bases: object

An immutable description of visual style for a chart.

Themes do not mutate global state until explicitly applied. Use as_context() to scope a theme to a with-block. Use apply_global() (or gufo.set_theme()) to set the global default.

__init__(name, rc)[source]#
property name#

The theme’s registered name.

merge(overrides)[source]#

Return a new Theme that is this theme with overrides applied. This theme is not modified.

rename(name)[source]#

Return a copy of this theme with a new name.

as_context()[source]#

Scope this theme to a with-block using plt.rc_context.

apply_global()[source]#

Apply this theme to matplotlib’s global rcParams.

Registry functions#

gufo.style.theme.set_theme(name='gufo_modern')[source]#

Apply a theme globally to all subsequent charts.

Return type:

None

Parameters:

name (str)

gufo.style.theme.get_theme(name)[source]#

Return the Theme registered under name.

Return type:

Theme

Parameters:

name (str)

gufo.style.theme.register_theme(theme)[source]#

Register a Theme so it can be referenced by name.

Return type:

None

Parameters:

theme (Theme)

gufo.style.theme.theme_context(name)[source]#

Temporarily apply a theme within a with-block.

Parameters:

name (str)