Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Background Configuration

Functions

FunctionDescription
set_global_background(color)Sets a global background color applied to all charts created after the call.
reset_global_background()Clears the global background, reverting to each chart's own default.
ParameterTypeDescription
colorstrCSS color string (hex "#rrggbb", "rgb(...)", named color)

Example

import seraplot as sp

sp.set_global_background("#0f172a")

bar = sp.build_bar_chart("Revenue", labels=["A", "B"], values=[300, 200])
pie = sp.build_pie_chart("Share", labels=["A", "B"], values=[60, 40])

sp.reset_global_background()

sp.set_global_background(...) is equivalent to sp.config(background=...), and is overridden by sp.theme(name) if a theme is applied afterward — see Themes for the built-in background/palette/gridlines bundles.

Fonctions

FonctionDescription
set_global_background(color)Définit une couleur de fond globale appliquée à tous les graphiques créés après l'appel.
reset_global_background()Efface le fond global, revenant à la valeur par défaut de chaque graphique.
ParamètreTypeDescription
colorstrCouleur CSS (hex "#rrggbb", "rgb(...)", nom de couleur)

Exemple

import seraplot as sp

sp.set_global_background("#0f172a")

barre = sp.build_bar_chart("Revenus", labels=["A", "B"], values=[300, 200])
camembert = sp.build_pie_chart("Parts", labels=["A", "B"], values=[60, 40])

sp.reset_global_background()

sp.set_global_background(...) équivaut à sp.config(background=...), et est écrasé par sp.theme(name) si un thème est appliqué ensuite — voir Thèmes pour la liste des thèmes intégrés (fond + palette + quadrillage).