Skip to content

Theming

Hatchlings uses CSS custom properties with the --hatch-* prefix. Two built-in themes are provided: dark and light.

Using Themes

With ThemeProvider

svelte
<script>
  import { ThemeProvider } from '@molbiohive/hatchlings';
</script>

<ThemeProvider theme="dark">
  <PlasmidViewer {data} />
</ThemeProvider>

With applyTheme

svelte
<script>
  import { darkTheme, applyTheme } from '@molbiohive/hatchlings';
  import { onMount } from 'svelte';

  let container;
  onMount(() => applyTheme(container, darkTheme));
</script>

<div bind:this={container}>
  <PlasmidViewer {data} />
</div>

With CSS

Set the variables directly in your stylesheet:

css
:root {
  --hatch-bg: #0c1018;
  --hatch-plot-bg: #141c26;
  --hatch-text: #d4dce6;
  /* ... */
}

Variable Reference

Core

VariableDarkLightDescription
--hatch-bg#0c1018#f5f3f0Background
--hatch-plot-bg#141c26#fafaf8Plot area background
--hatch-text#d4dce6#2a2e34Primary text
--hatch-text-muted#8a95a5#6a7080Secondary text
--hatch-text-dim#566070#9aa0acDim text
--hatch-border#2a3848#d8d6d2Borders
--hatch-grid-color#1e2a38#e8e6e2Grid lines
--hatch-highlight#6ab8e0#3a8ab0Highlight/accent

Axes

VariableDarkLightDescription
--hatch-axis-color#3a4858#c8ccd4Axis lines
--hatch-axis-text#7a8898#6a7080Tick labels
--hatch-axis-label#95a3b3#5a6070Axis titles

Semantic

VariableDarkLightDescription
--hatch-positive#58b56a#3a8a4aSuccess/positive
--hatch-negative#d45858#c04040Error/negative
--hatch-warning#d9953a#b87a28Warning

Selection

VariableDarkLightDescription
--hatch-selection-fillrgba(59,130,246,0.15)rgba(59,130,246,0.12)Selection fill
--hatch-selection-strokergba(59,130,246,0.6)rgba(59,130,246,0.5)Selection border
--hatch-selection-handlergba(59,130,246,0.8)rgba(59,130,246,0.8)Selection drag handles
--hatch-caret-color#ffffff#000000Caret/cursor

Tooltip

VariableDarkLightDescription
--hatch-tooltip-bg#141c26#fafaf8Tooltip background
--hatch-tooltip-border#2a3848#d8d6d2Tooltip border
--hatch-tooltip-text#d4dce6#2a2e34Tooltip text
--hatch-tooltip-label#8a95a5#6a7080Tooltip label text

Plasmid

VariableDarkLightDescription
--hatch-ring-color#4a5a6a#8a9098Plasmid ring
--hatch-tick-major#5a6a7a#7a8088Major tick marks
--hatch-tick-minor#3a4858#b8bcc4Minor tick marks
--hatch-cut-site#d45858#c04040Cut site markers

Sequence Viewer

VariableDarkLightDescription
--hatch-seq-bgtransparenttransparentViewer background
--hatch-seq-border#2a3848#d8d6d2Viewer border
--hatch-ruler-color#4a5a6a#8a9098Ruler tick marks
--hatch-ruler-text#7a8898#6a7080Ruler numbers
--hatch-line-number#566070#9aa0acLine numbers
--hatch-cutsite-color#d45858#c04040Cut site indicators

Plate Heatmap

VariableDarkLightDescription
--hatch-plate-bgtransparenttransparentPlate background
--hatch-plate-border#2a3848#d8d6d2Plate border
--hatch-well-border#2a3848#d8d6d2Well borders
--hatch-well-text#ffffff#2a2e34Well label text
--hatch-empty-well#1e2a38#e8e6e2Empty well fill

Controls

VariableDarkLightDescription
--hatch-controls-bg#1e2a38#e8e6e2Control bar background
--hatch-controls-border#3a4858#c8ccd4Control bar border
--hatch-controls-color#d4dce6#2a2e34Control text/icons
--hatch-controls-hover#2a3848#d8d6d2Control hover state

Custom Themes

Create a custom theme by defining a Record<string, string> with --hatch-* keys:

typescript
import type { HatchTheme } from '@molbiohive/hatchlings';

const myTheme: HatchTheme = {
  '--hatch-bg': '#1a1a2e',
  '--hatch-plot-bg': '#16213e',
  '--hatch-text': '#e8e8e8',
  '--hatch-highlight': '#e94560',
  // ... override any variables
};