Skip to main content

detectHostTheme

megane-viewer


megane-viewer / detectHostTheme

Function: detectHostTheme()

detectHostTheme(doc?): ResolvedTheme | null

Defined in: stores/useThemeStore.ts:39

The theme the embedding host (not the OS) is showing, when it says so.

  • JupyterLab marks <body data-jp-theme-light="true|false">.
  • VSCode webviews (custom editor and notebook outputs) put vscode-light, vscode-dark, vscode-high-contrast or vscode-high-contrast-light on <body> and mirror it in data-vscode-theme-kind.

A VSCode or JupyterLab theme can disagree with the OS preference, so "system" follows the host first and prefers-color-scheme only elsewhere.

Parameters​

doc?​

Document | undefined

Returns​

ResolvedTheme | null