Skip to main content

Themes, presets and scenes

Three levels, each built on the one below.

LevelAnswersExport
ThemeWhat colours?themes
PresetWhat does it look like?presets
SceneWhat am I making?scenes

Themes

Nine palettes: atlas, midnight, mono, hologram, neon, blueprint, aurora, noir, political.

import { themes } from "canvas-globe";

themes.midnight.land; // "#39496b"

Theme keys

Pass a partial object to override any subset; missing keys fall back to atlas.

KeyTypeUsed for
ocean[string, string]Gradient stops
landstringLandmass fill
borderstringCountry outlines
graticulestringGrid lines
atmospherestringHalo outside the sphere
rimstringSphere edge
markerstringDefault marker colour
markerGlowstringMarker halo
livestringPulse rings and pings
bubblestringBubble marker background
labelstringText
starsstringStarfield
dotstringLand dots for landStyle: "dots"
glowstringHalo for landStyle: "glow"
orbitstringOrbit rings
arcstringArc base colour
arcHeadstringArc comet head
nightstringTerminator overlay
clusterstringCluster bubble fill
clusterLabelstringCluster count text
focusstringKeyboard focus ring
countryHoverstringHovered country wash
shadebooleanEnables lit-from-upper-left shading

CSS custom properties

theme: "css" reads --geo-* off the canvas, in dash-case:

#globe {
--geo-land: #334155;
--geo-ocean-from: #0f172a;
--geo-ocean-to: #020617;
--geo-marker-glow: rgba(249, 115, 22, 0.4);
}

theme: "auto" follows prefers-color-scheme.

Presets

A preset bundles a theme with a render style.

PresetThemeLand styleExtras
atlasatlasfillstars, shading
midnightmidnightfillstars, shading
monomonofillNot set
politicalpoliticalfillcountryColors: "auto"
hologramhologramdotsstars
neonneonglowstars
blueprintblueprintoutline3 orbits
auroraauroradots2 orbits, stars
noirnoiroutlineNot set
constellationhologramdots (sparse)3 orbits, stars
createGlobe(canvas, { preset: "blueprint" });
globe.setPreset("noir");

setPreset resets every key the new preset does not set, so nothing leaks between looks. The keys it owns are theme, landStyle, dotSpacing, dotSize, graticule, stars, shade, orbits and countryColors.

Scenes

A scene is a whole composition: preset plus the layers and overlays a given job needs.

SceneBuilt for
signupsLive activity on a pricing or landing page
launchA regional announcement, ready for country media
logos"Trusted in N countries" with customer logos
teamWhere the team is, on a careers page
coverageCampaign or revenue by country, with a legend
reviewScroll-linked year in review
routesTraffic between regions
createGlobe(canvas, { scene: "signups" });
globe.setScene("coverage");
globe.setScene("launch", { focus: { country: "IN", isolate: true } });

Scenes also reset cleanly. The keys they own additionally include mode, cluster, tooltip, labels, legend, counter, focus, showViewer and the motion settings.

Precedence

defaults → scene → scene's preset → your preset → your options
// Scene sets hologram; your theme wins.
createGlobe(canvas, { scene: "signups", theme: "noir" });