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, values)

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"

[0x6366F1, 0xF43F5E, 0x10B981, 0xF59E0B, 0x8B5CF6,
 0x06B6D4, 0xEC4899, 0x84CC16, 0xEF4444, 0x14B8A6]

"scientific"

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

"apple"

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

"notion"

[0xE3E3E3, 0xA0A0A0, 0xCB9D6D, 0x7C9E7E, 0x7B8FC4,
 0xC17B7B, 0xD4A76A, 0x8BA4B0, 0xB39DDB, 0x80CBC4]

"minimal"

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

"neon"

[0x00FFF0, 0xFF00FF, 0x00FF41, 0xFF6B00, 0xFFFF00,
 0xFF1493, 0x00BFFF, 0xFF4500, 0x7FFF00, 0xDA70D6]

Examples

import seraplot as sp

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

sp.theme("neon")
sp.scatter("Clusters", x, y).show()

sp.theme("scientific")
sp.line("Population Growth", years, values).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)

See also

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, values)

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"

[0x6366F1, 0xF43F5E, 0x10B981, 0xF59E0B, 0x8B5CF6,
 0x06B6D4, 0xEC4899, 0x84CC16, 0xEF4444, 0x14B8A6]

"scientific"

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

"apple"

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

"notion"

[0xE3E3E3, 0xA0A0A0, 0xCB9D6D, 0x7C9E7E, 0x7B8FC4,
 0xC17B7B, 0xD4A76A, 0x8BA4B0, 0xB39DDB, 0x80CBC4]

"minimal"

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

"neon"

[0x00FFF0, 0xFF00FF, 0x00FF41, 0xFF6B00, 0xFFFF00,
 0xFF1493, 0x00BFFF, 0xFF4500, 0x7FFF00, 0xDA70D6]

Exemples

import seraplot as sp

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

sp.theme("neon")
sp.scatter("Clusters", x, y).show()

sp.theme("scientific")
sp.line("Croissance démographique", annees, valeurs).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)

Voir aussi