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

Themes

API

FunctionDescription
sp.theme(name)Apply a built-in theme — sets background, palette, and gridlines globally
sp.reset_theme()Revert to defaults (no background, default palette, no gridlines)
sp.themes()Returns a list of all available theme names
import seraplot as sp

sp.theme("dark")
chart = sp.bar("Revenue", labels=["Q1", "Q2", "Q3"], values=[120, 145, 98])

sp.reset_theme()

All 7 themes

ThemeBackgroundGridlinesInspirationPrimary palette
"dark" #0f172aDeep space / Tailwind indigo
"light"transparentClean minimal
"scientific" #fafafaMatplotlib / D3 academic
"apple" #000000Apple dark mode (iOS/macOS)
"notion" #191919Notion editorial dark
"minimal"transparentMonochrome grayscale
"neon" #0a0a0aCyberpunk / retrowave

Full palette per theme

"dark"

[0x818CF8, 0xFB7185, 0x34D399, 0xFBBF24, 0xA78BFA,
 0x22D3EE, 0xF472B6, 0xA3E635, 0xF87171, 0x2DD4BF]

"light"

[0x636EFA, 0xEF553B, 0x00CC96, 0xAB63FA, 0xFFA15A,
 0x19D3F3, 0xFF6692, 0xB6E880, 0xFF97FF, 0xFECB52]

"scientific"

[0x1F77B4, 0xFF7F0E, 0x2CA02C, 0xD62728, 0x9467BD,
 0x8C564B, 0xE377C2, 0x7F7F7F, 0xBCBD22, 0x17BECF]

"apple"

[0x0A84FF, 0x30D158, 0xFF453A, 0xFFD60A, 0xBF5AF2,
 0x64D2FF, 0xFF9F0A, 0xFF375F, 0xAC8E68, 0x63E6E2]

"notion"

[0x529CCA, 0xD08B65, 0x6C9B7D, 0xCB7C7A, 0x9A6DD7,
 0x868686, 0xCCAA55, 0x75B5AA, 0xD477A8, 0x507AA6]

"minimal"

[0x374151, 0x6B7280, 0x9CA3AF, 0xD1D5DB, 0x111827,
 0x4B5563, 0x1F2937, 0xE5E7EB, 0x030712, 0x6B7280]

"neon"

[0x00FF87, 0xFF006E, 0x00B4D8, 0xFFBE0B, 0xE500A4,
 0x8338EC, 0x3A86FF, 0xFB5607, 0xFF006E, 0x06D6A0]

Examples

import seraplot as sp

sp.theme("dark")
sp.bar("Revenue", labels=["Q1", "Q2", "Q3", "Q4"], values=[120, 145, 98, 180]).show()

sp.theme("neon")
sp.scatter(title="Clusters", x=[1, 2, 3, 4, 5, 6], y=[2, 5, 3, 8, 7, 9]).show()

sp.theme("scientific")
sp.line(title="Population Growth", x_labels=["2020", "2021", "2022", "2023"], values=[100, 112, 121, 135]).show()

sp.reset_theme()
print(sp.themes())
# ['dark', 'light', 'scientific', 'apple', 'notion', 'minimal', 'neon']

Notes

  • sp.theme() sets the global background, palette, and gridlines. It is equivalent to calling sp.config(background=..., palette=..., gridlines=...) with the preset values.
  • Themes persist until sp.reset_theme() or sp.config() overrides them.
  • You can further override individual properties after calling a theme:
sp.theme("dark")
sp.config(font_size=16, border_radius=12)

API

FonctionDescription
sp.theme(name)Applique un thème intégré — définit le fond, la palette et le quadrillage globalement
sp.reset_theme()Revient aux valeurs par défaut (pas de fond, palette par défaut, pas de quadrillage)
sp.themes()Retourne la liste de tous les noms de thèmes disponibles
import seraplot as sp

sp.theme("dark")
graphique = sp.bar("Revenus", labels=["T1", "T2", "T3"], values=[120, 145, 98])

sp.reset_theme()

Les 7 thèmes disponibles

ThèmeFondQuadrillageInspirationPalette principale
"dark" #0f172aEspace profond / indigo Tailwind
"light"transparentÉpuré minimal
"scientific" #fafafaMatplotlib / D3 académique
"apple" #000000Mode sombre Apple (iOS/macOS)
"notion" #191919Notion éditorial sombre
"minimal"transparentNuances de gris monochrome
"neon" #0a0a0aCyberpunk / retrowave

Palettes complètes

"dark"

[0x818CF8, 0xFB7185, 0x34D399, 0xFBBF24, 0xA78BFA,
 0x22D3EE, 0xF472B6, 0xA3E635, 0xF87171, 0x2DD4BF]

"light"

[0x636EFA, 0xEF553B, 0x00CC96, 0xAB63FA, 0xFFA15A,
 0x19D3F3, 0xFF6692, 0xB6E880, 0xFF97FF, 0xFECB52]

"scientific"

[0x1F77B4, 0xFF7F0E, 0x2CA02C, 0xD62728, 0x9467BD,
 0x8C564B, 0xE377C2, 0x7F7F7F, 0xBCBD22, 0x17BECF]

"apple"

[0x0A84FF, 0x30D158, 0xFF453A, 0xFFD60A, 0xBF5AF2,
 0x64D2FF, 0xFF9F0A, 0xFF375F, 0xAC8E68, 0x63E6E2]

"notion"

[0x529CCA, 0xD08B65, 0x6C9B7D, 0xCB7C7A, 0x9A6DD7,
 0x868686, 0xCCAA55, 0x75B5AA, 0xD477A8, 0x507AA6]

"minimal"

[0x374151, 0x6B7280, 0x9CA3AF, 0xD1D5DB, 0x111827,
 0x4B5563, 0x1F2937, 0xE5E7EB, 0x030712, 0x6B7280]

"neon"

[0x00FF87, 0xFF006E, 0x00B4D8, 0xFFBE0B, 0xE500A4,
 0x8338EC, 0x3A86FF, 0xFB5607, 0xFF006E, 0x06D6A0]

Exemples

import seraplot as sp

sp.theme("dark")
sp.bar("Revenus", labels=["T1", "T2", "T3", "T4"], values=[120, 145, 98, 180]).show()

sp.theme("neon")
sp.scatter(title="Clusters", x=[1, 2, 3, 4, 5, 6], y=[2, 5, 3, 8, 7, 9]).show()

sp.theme("scientific")
sp.line(title="Croissance démographique", x_labels=["2020", "2021", "2022", "2023"], values=[100, 112, 121, 135]).show()

sp.reset_theme()
print(sp.themes())
# ['dark', 'light', 'scientific', 'apple', 'notion', 'minimal', 'neon']

Notes

  • sp.theme() définit le fond global, la palette et le quadrillage. C'est équivalent à sp.config(background=..., palette=..., gridlines=...) avec les valeurs du préréglage.
  • Les thèmes persistent jusqu'à sp.reset_theme() ou un appel sp.config() qui les écrase.
  • Vous pouvez continuer à surcharger des propriétés individuelles après avoir appliqué un thème :
sp.theme("dark")
sp.config(font_size=16, border_radius=12)