Skip to content

Theming

aseview has five visual themes. A theme sets the interface colors, typography, panel style and the default background; it is separate from the molecule rendering style (cartoon, cinematic, bubble, ...), see Styles.

Available Themes

Theme Description
spring Spring theme (default) with bright, airy colors
simple Light macOS-style theme with colorful gradient background
glass Glassmorphism theme with frosted translucent panels
dark Dark theme with deep grey background
darkgreen Dark GitHub-style theme with green accent

All five themes are built into the viewer engine, so every viewer (MolecularViewer, NormalViewer, OverlayViewer, FragSelector, SurfaceViewer, LiteViewer) supports every theme, and the page stays one self-contained file.

Python API

Per-viewer theme

Pass theme= to any viewer constructor:

from aseview import FragSelector, MolecularViewer, NormalViewer, OverlayViewer

MolecularViewer(atoms, theme="dark")
NormalViewer(atoms, vibrations=vib, theme="glass")
FragSelector(atoms, theme="simple")
OverlayViewer([atoms1, atoms2], theme="darkgreen")

Default theme

Set once for the session:

import aseview

aseview.set_theme("dark")        # viewers created afterwards use dark
aseview.get_theme()              # 'dark'
aseview.list_themes()            # ['spring', 'simple', 'glass', 'dark', 'darkgreen']

A theme also picks the default background color; pass background_color= to override it.

CLI

aseview molecule.xyz --theme dark
aseview molecule.xyz -t glass -o out.html
aseview molecule.xyz -v normal --theme dark --hess mol.hess

JavaScript Module

const viewer = new ASEView.MolecularViewer('#container', { theme: 'dark' });
viewer.setSettings({ theme: 'glass' });   // switch later

Adding a theme

Themes are CSS token sets in viewer/src/themes/ (base.css holds the tokens per [data-theme], index.ts the default backgrounds). Add a token block and a background entry, add the name to the theme options in viewer/src/core/schema/settings.ts, then rebuild the engine:

cd viewer && npm run build

The new name is then accepted by theme=, set_theme(), --theme, and the JavaScript module.