getDefaultColorTheme
Returns the appropriate default color theme based on the dark mode preference.
function getDefaultColorTheme(opts: {
isDarkMode: boolean;
}): TLDefaultColorTheme;Example
import { getDefaultColorTheme } from "@tldraw/tlschema";
// Get light theme
const lightTheme = getDefaultColorTheme({ isDarkMode: false });
// Get dark theme
const darkTheme = getDefaultColorTheme({ isDarkMode: true });
// Use with editor
const theme = getDefaultColorTheme({
isDarkMode: window.matchMedia("(prefers-color-scheme: dark)").matches,
});Parameters
| Name | Description |
|---|---|
| Configuration options - isDarkMode - Whether to return the dark theme (true) or light theme (false) |
Returns
The corresponding TLDefaultColorTheme (light or dark)
Prev
getColorValueNext
getDefaultTranslationLocale