Files changed: engine/.embcache.json engine/changelog.md engine/lint-report.md vault/.trash/2026-06-19.md vault/docs/hardware/environment.md vault/docs/hardware/ip-allocation.md vault/docs/matrix/archivist.md vault/docs/matrix/matrix_host.md vault/docs/matrix/mautrix_signal.md vault/docs/matrix/synapse.md vault/docs/matrix/synapse_retention_discovery.md vault/docs/navi/cc-rules.md vault/docs/navi/deployment.md vault/docs/navi/themes.md vault/docs/services/ots-setup.md vault/docs/services/services.md vault/docs/services/usenet.md vault/docs/software/authentik.md vault/docs/software/caddy.md vault/docs/software/central.md vault/docs/software/dns.md vault/docs/software/geo-tools.md vault/docs/software/navi.md vault/docs/software/recon.md vault/docs/software/searxng.md vault/glossary.md vault/notes/echo6-landing-page-data-export.md vault/notes/ia-download-queue.md vault/projects/advbbs-project.md vault/projects/argus.md vault/projects/deploy-livesync.md vault/projects/fleet-patch-audit.md vault/projects/fleet-platform-baseline.md vault/projects/matrix-synapse-deployment.md vault/projects/meshai-config-hot-apply.md vault/projects/meshai-region-routing-plan.md vault/projects/meshai.md vault/projects/meshcore-transport.md vault/projects/meshtastic-headscale-runbook.md vault/projects/mmud-project.md vault/projects/nominatim-v5-reimport.md vault/runbooks/add-peertube-channel.md vault/runbooks/authentik-access-groups.md vault/runbooks/authentik-create-invitation.md vault/runbooks/authentik-oidc-application.md vault/runbooks/authentik-upgrade.md vault/runbooks/central-deploy-cutover.md vault/runbooks/ct-runbook.md vault/runbooks/edge2-access-reference.md vault/runbooks/expose-service-contabo.md vault/runbooks/expose-service-edge2.md vault/runbooks/expose-service-home.md vault/runbooks/fleet-magicdns-resolved-migration.md vault/runbooks/headless-browser-page-verification.md vault/runbooks/headscale-oidc-boot-order.md vault/runbooks/headscale-onboard-node.md vault/runbooks/ia-cli-reference.md vault/runbooks/ia-download-mirror.md vault/runbooks/idahomesh-bridge-setup.md vault/runbooks/idahomesh-vpn-device-setup.md vault/runbooks/lxc-service-migration.md vault/runbooks/mailcow-create-mailbox.md vault/runbooks/meshai-prod-compose-override.md vault/runbooks/meshmonitor-password-reset.md vault/runbooks/meshtastic-sidecar-node.md vault/runbooks/meshtasticd-sim-nodes-runbook.md vault/runbooks/nordvpn-lxc.md vault/runbooks/peertube-remote-runner.md vault/runbooks/pg-backup.md vault/runbooks/pi-nas-omv-runbook.md vault/runbooks/pipeline-patterns.md vault/runbooks/proxmox-create-ubuntu-vm.md vault/runbooks/proxmox-onboard-node.md vault/runbooks/pymc-repeater-kiss-tnc-reenumeration.md vault/runbooks/recon-operations.md vault/runbooks/recon-service-integration.md vault/runbooks/syncthing-add-node.md vault/runbooks/toc-cortex-pve9.2-update.md vault/session-resume/SESSION-HANDOFF-meshai-test.md
129 lines
4 KiB
Markdown
129 lines
4 KiB
Markdown
---
|
|
title: Navi Theme System
|
|
type: reference
|
|
tags:
|
|
- auth
|
|
aliases: []
|
|
related:
|
|
- [[navi]]
|
|
- [[cc-rules]]
|
|
- [[deployment]]
|
|
- [[searxng]]
|
|
- [[echo6-landing-page-data-export]]
|
|
updated: 2026-07-13
|
|
---
|
|
# Navi Theme System
|
|
|
|
## Architecture
|
|
|
|
**Registry:** `src/themes/registry.js`
|
|
[[central]] source for theme metadata, overlay config, UI CSS vars, and satellite adjustments.
|
|
|
|
## Critical: namedTheme Import
|
|
|
|
> **NEVER re-export namedTheme through registry.js or any other module.**
|
|
|
|
namedTheme must be imported **directly** from protomaps-themes-base in MapView.jsx:
|
|
|
|
```javascript
|
|
// CORRECT
|
|
import { layers, namedTheme } from 'protomaps-themes-base'
|
|
import { getTheme, getThemeSprite, getOverlayConfig } from '../themes/registry'
|
|
|
|
function buildStyle(themeName) {
|
|
const theme = getTheme(themeName)
|
|
const colors = theme.colors || namedTheme(themeName) // direct import for built-ins
|
|
return {
|
|
// ...
|
|
layers: layers('protomaps', colors, { lang: 'en' }),
|
|
}
|
|
}
|
|
```
|
|
|
|
**Why:** Vite's bundling of namedTheme through a re-export breaks MapLibre's Web Worker, causing silent GeoJSON rendering failure (routes, boundaries, measure tool all invisible, "f is not defined" error in worker).
|
|
|
|
## Theme Config Shape
|
|
|
|
```javascript
|
|
{
|
|
id: 'dark', // unique identifier
|
|
name: 'Dark', // display name
|
|
dark: true, // affects overlay styling, sprite fallback
|
|
swatch: ['#1c1917', '#7a9a6b', '#b8a88a'], // theme picker preview
|
|
fontImports: [], // Google Font URLs (empty = system fonts)
|
|
colors: null, // null = built-in, object = custom theme colors
|
|
satellite: null, // raster adjustments when satellite active
|
|
overlay: { ... }, // per-layer styling for overlays
|
|
ui: { ... }, // 32 CSS custom properties
|
|
}
|
|
```
|
|
|
|
## UI CSS Variables
|
|
|
|
Applied by applyThemeUI() via document.documentElement.style.setProperty():
|
|
|
|
- Backgrounds: --bg-base, --bg-raised, --bg-overlay, --bg-input, --bg-inset, --bg-muted
|
|
- Text: --text-primary, --text-secondary, --text-tertiary, --text-inverse
|
|
- Borders: --border, --border-subtle
|
|
- Accent: --accent, --accent-hover, --accent-muted
|
|
- Pins: --pin-origin, --pin-destination, --pin-intermediate, --pin-stroke
|
|
- Status: --status-success, --status-warning, --status-danger, --success, --warning, --warning-muted
|
|
- Fonts: --font-sans, --font-mono, --font-heading
|
|
- Shadows: --shadow, --shadow-lg
|
|
|
|
## Overlay Config
|
|
|
|
Read via getOverlayConfig(themeId, layerKey) with spread-defaults fallback:
|
|
|
|
- hillshade: exaggeration, illuminationDirection, shadowColor, highlightColor
|
|
- contours: colors, opacities, widths for minor/intermediate/index lines + labels
|
|
- publicLands: fill/outline colors per agency (NPS, USFS, BLM, etc.)
|
|
- usfsTrails: road/trail colors by use type (motorized, bicycle, hiker)
|
|
- blmTrails: route colors by vehicle class (4WD, ATV, non-mechanized)
|
|
|
|
## Satellite Raster Adjustments
|
|
|
|
Neutral defaults (no adjustment):
|
|
|
|
```javascript
|
|
satellite: {
|
|
opacity: 1.0,
|
|
brightnessMin: 0.0,
|
|
brightnessMax: 1.0,
|
|
contrast: 0.0, // MapLibre uses -1 to 1 range
|
|
saturation: 0.0, // MapLibre uses -1 to 1 range
|
|
hueRotate: 0,
|
|
}
|
|
```
|
|
|
|
## Font Support
|
|
|
|
fontImports array of Google Font URLs, managed on theme switch:
|
|
|
|
```javascript
|
|
fontImports: [
|
|
'https://fonts.googleapis.com/css2?family=Orbitron&display=swap',
|
|
'https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap',
|
|
]
|
|
```
|
|
|
|
Injected as <link data-theme-font> tags, removed on theme switch.
|
|
|
|
## Theme Picker
|
|
|
|
ThemePicker.jsx — swatch popover in header, reads themeList() for [{id, name, dark, swatch}].
|
|
|
|
## Current Themes
|
|
|
|
| ID | Name | Type | Description |
|
|
|----|------|------|-------------|
|
|
| light | Light | built-in | Default light theme |
|
|
| dark | Dark | built-in | Default dark theme |
|
|
| clean | Clean | custom | Google Maps-inspired, utilitarian |
|
|
| cyberpunk | Cyberpunk | custom | Neon palette, Orbitron + Share Tech Mono fonts |
|
|
|
|
## Adding a New Theme
|
|
|
|
1. Create src/themes/{name}.js with full theme config
|
|
2. Import and register in registry.js themes object
|
|
3. Theme auto-appears in picker via themeList()
|