@viamrobotics/tweakpane-config
@viamrobotics/tweakpane-config exposes a Theme preset that matches Viam’s design system. Drop it into svelte-tweakpane-ui’s ThemeUtils.setGlobalDefaultTheme and every component on the page renders with Viam’s palette and typography.
Installation
Section titled “Installation”-
Install the package and its peer:
Terminal window pnpm add @viamrobotics/tweakpane-config svelte-tweakpane-uiTerminal window npm install @viamrobotics/tweakpane-config svelte-tweakpane-uiTerminal window yarn add @viamrobotics/tweakpane-config svelte-tweakpane-ui -
Apply
primeThemeas the global default near the top of your app. Refer to the svelte-tweakpane-ui themes documentation for the supported usage patterns (global default, per-componentthemeprop, partial overrides).<script lang="ts">import { primeTheme } from '@viamrobotics/tweakpane-config';import { ThemeUtils } from 'svelte-tweakpane-ui';ThemeUtils.setGlobalDefaultTheme(primeTheme);</script>
Extending the theme
Section titled “Extending the theme”primeTheme is a plain Theme object, so it composes with the spread operator:
import { primeTheme } from "@viamrobotics/tweakpane-config";import { ThemeUtils, type Theme } from "svelte-tweakpane-ui";
const compactTheme: Theme = { ...primeTheme, containerUnitSize: "20px",};
ThemeUtils.setGlobalDefaultTheme(compactTheme);Dark mode
Section titled “Dark mode”primeThemeDark is the dark variant of primeTheme, with the same shape and values mirroring the dark tokens in @viamrobotics/tailwind-config.
Wire it to the OS preference yourself. This is consumer-owned glue, not a package export:
import { primeTheme, primeThemeDark } from "@viamrobotics/tweakpane-config";import { ThemeUtils } from "svelte-tweakpane-ui";
const query = window.matchMedia("(prefers-color-scheme: dark)");const apply = () => ThemeUtils.setGlobalDefaultTheme(query.matches ? primeThemeDark : primeTheme);
apply();query.addEventListener("change", apply);<script lang="ts"> import { onMount } from "svelte"; import { primeTheme, primeThemeDark } from "@viamrobotics/tweakpane-config"; import { ThemeUtils } from "svelte-tweakpane-ui";
let mode = $state<"light" | "dark">("light");
// Seed from the OS preference on first client load; a toggle can take over after. onMount(() => { mode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; });
// $effect runs only on the client, dodging window access during prerender. $effect(() => { ThemeUtils.setGlobalDefaultTheme(mode === "dark" ? primeThemeDark : primeTheme); });</script>The theme references Public Sans Variable. Load it via @viamrobotics/tailwind-config or directly from @fontsource-variable/public-sans. If the font isn’t loaded, browsers fall back to the system sans-serif.
Blades
Section titled “Blades”Every island below is a live svelte-tweakpane-ui component themed with primeTheme and primeThemeDark. Switch the site theme to see both. Each island sets the global default theme in an $effect, which runs only on the client because Tweakpane reads window. In an app you set the global default theme once, near the root.
Slider
Section titled “Slider”Code
<script lang="ts"> import { theme } from "@docs/theme.svelte.ts"; import { primeTheme, primeThemeDark } from "@viamrobotics/tweakpane-config"; import { Slider } from "svelte-tweakpane-ui";
let value = $state(0.5);
const paneTheme = $derived( theme.current === "dark" ? primeThemeDark : primeTheme, );</script>
<Slider theme={paneTheme} bind:value min={0} max={1} step={0.01} label="Slider" />Code
<script lang="ts"> import { theme } from "@docs/theme.svelte.ts"; import { primeTheme, primeThemeDark } from "@viamrobotics/tweakpane-config"; import { List, type ListOptions } from "svelte-tweakpane-ui";
const options: ListOptions<string> = { Power_wire: "power-wire", Solar_power: "solar-power", Hologram: "hologram", Cyberpunk: "cyberpunk", }; let value = $state("cyberpunk");
const paneTheme = $derived( theme.current === "dark" ? primeThemeDark : primeTheme, );</script>
<List theme={paneTheme} bind:value {options} label="List" />Checkbox
Section titled “Checkbox”Code
<script lang="ts"> import { theme } from "@docs/theme.svelte.ts"; import { primeTheme, primeThemeDark } from "@viamrobotics/tweakpane-config"; import { Checkbox } from "svelte-tweakpane-ui";
let value = $state(true);
const paneTheme = $derived( theme.current === "dark" ? primeThemeDark : primeTheme, );</script>
<Checkbox theme={paneTheme} bind:value label="Checkbox" />Code
<script lang="ts"> import { theme } from "@docs/theme.svelte.ts"; import { primeTheme, primeThemeDark } from "@viamrobotics/tweakpane-config"; import { Color } from "svelte-tweakpane-ui";
let value = $state("#2e67d3");
const paneTheme = $derived( theme.current === "dark" ? primeThemeDark : primeTheme, );</script>
<Color theme={paneTheme} bind:value label="Color" />Point (3D)
Section titled “Point (3D)”Code
<script lang="ts"> import { theme } from "@docs/theme.svelte.ts"; import { primeTheme, primeThemeDark } from "@viamrobotics/tweakpane-config"; import { Point, type PointValue3d } from "svelte-tweakpane-ui";
let value: PointValue3d = $state({ x: 0, y: 0, z: 0 });
const paneTheme = $derived( theme.current === "dark" ? primeThemeDark : primeTheme, );</script>
<Point theme={paneTheme} bind:value label="Point" />RotationEuler
Section titled “RotationEuler”Code
<script lang="ts"> import { theme } from "@docs/theme.svelte.ts"; import { primeTheme, primeThemeDark } from "@viamrobotics/tweakpane-config"; import { RotationEuler, type RotationEulerValue } from "svelte-tweakpane-ui";
let value: RotationEulerValue = $state({ x: 0, y: 0, z: 0 });
const paneTheme = $derived( theme.current === "dark" ? primeThemeDark : primeTheme, );</script>
<RotationEuler theme={paneTheme} bind:value label="Rotation" />Button
Section titled “Button”Code
<script lang="ts"> import { theme } from "@docs/theme.svelte.ts"; import { primeTheme, primeThemeDark } from "@viamrobotics/tweakpane-config"; import { Button } from "svelte-tweakpane-ui";
let clickCount = $state(0);
const paneTheme = $derived( theme.current === "dark" ? primeThemeDark : primeTheme, );</script>
<Button theme={paneTheme} title="Clicked {clickCount} times" label="Button" on:click={() => { clickCount += 1; }}/>Monitor
Section titled “Monitor”Code
<script lang="ts"> import { theme } from "@docs/theme.svelte.ts"; import { primeTheme, primeThemeDark } from "@viamrobotics/tweakpane-config"; import { Monitor, Slider } from "svelte-tweakpane-ui";
let value = $state(0.5);
const paneTheme = $derived( theme.current === "dark" ? primeThemeDark : primeTheme, );</script>
<Slider theme={paneTheme} bind:value min={0} max={1} step={0.01} label="Slider" /><Monitor theme={paneTheme} {value} label="Monitor" graph interval={50} min={0} max={1} />Code
<script lang="ts"> import { theme } from "@docs/theme.svelte.ts"; import { primeTheme, primeThemeDark } from "@viamrobotics/tweakpane-config"; import { Checkbox, Pane, Slider } from "svelte-tweakpane-ui";
let amount = $state(0.25); let isEnabled = $state(true);
const paneTheme = $derived( theme.current === "dark" ? primeThemeDark : primeTheme, );</script>
<Pane theme={paneTheme} position="inline" title="Settings"> <Slider bind:value={amount} min={0} max={1} step={0.01} label="Amount" /> <Checkbox bind:value={isEnabled} label="Enabled" /></Pane>TabGroup and TabPage
Section titled “TabGroup and TabPage”Code
<script lang="ts"> import { theme } from "@docs/theme.svelte.ts"; import { primeTheme, primeThemeDark } from "@viamrobotics/tweakpane-config"; import { Checkbox, Color, Slider, TabGroup, TabPage } from "svelte-tweakpane-ui";
let accent = $state("#a51aff"); let amount = $state(0.25); let isEnabled = $state(true); let selectedIndex = $state(0);
const paneTheme = $derived( theme.current === "dark" ? primeThemeDark : primeTheme, );</script>
<TabGroup theme={paneTheme} bind:selectedIndex> <TabPage title="Color"> <Color bind:value={accent} label="Accent" /> </TabPage> <TabPage title="Slider"> <Slider bind:value={amount} min={0} max={1} step={0.01} label="Amount" /> </TabPage> <TabPage title="Toggle"> <Checkbox bind:value={isEnabled} label="Enabled" /> </TabPage></TabGroup>