Whiteboard SDK
Theming & Dark Mode
Complete guide to dual-theme contrast resolution, dark mode palettes, and scoped CSS theme bundles.
Both @filekit-studio/sketch and @filekit-studio/diagram feature automatic dual-theme visual balance with real-time contrast resolution.
1. Live Light vs. Dark Mode Comparison
Notice how element strokes, text, and fill patterns automatically adapt between themes:
Light Theme
Loading diagram canvas...
2. Setting Canvas Theme in Code
Pass theme="dark" or theme="light" to <SketchEditor />, <SketchViewer />, or <Diagram />:
"use client";
import React from "react";
import { Diagram, type DiagramData } from "@filekit-studio/diagram";
export function ThemedCanvas({ data, isDark }: { data: DiagramData; isDark: boolean }) {
return (
<div className="w-full h-[400px] rounded-xl overflow-hidden border">
<Diagram
data={data}
mode="viewer"
theme={isDark ? "dark" : "light"}
canvasBackground={isDark ? "#12141a" : "#f0f4f8"}
gridStyle="dots"
/>
</div>
);
}3. Dedicated Scoped CSS Bundles
@filekit-studio/sketch exports three standalone, fully scoped theme stylesheets:
- Modern Minimal (Default):
TypeScript (TSX) import "@filekit-studio/sketch/styles.css"; - Classic White Theme:
TypeScript (TSX) import "@filekit-studio/sketch/classic.css"; // Pair with: <SketchEditor panelVariant="classic" /> - Neumorphic Soft 3D Theme:
TypeScript (TSX) import "@filekit-studio/sketch/neumorphic.css"; // Pair with: <SketchEditor panelVariant="neumorphic" />
[!NOTE] All CSS classes in these bundles are scoped strictly inside
.fk-sketch-root, guaranteeing zero CSS variable or style leaks into your host Tailwind or global CSS.
4. Recommended Background Palettes
| Theme | Setting | Hex Code | Best Paired With |
|---|---|---|---|
| Light | Crisp Ice Blue | #f0f4f8 | Documentation embeds, blogs |
| Light | Studio Off-White | #ffffff | Clean minimal whiteboards |
| Dark | Deep Obsidian Slate | #12141a | Dark mode documentation sites |
| Dark | Midnight Charcoal | #0f1117 | High contrast OLED displays |
| Dark | Deep Pitch Black | #000000 | Terminal & dev tool consoles |