Detect light/dark theme programmatically in Visual Studio Code
<p>I'm developing a Visual Studio Code <a href="https://github.com/vstirbu/vscode-mermaid-preview" rel="nofollow noreferrer">extension</a> that enables previewing <a href="http://knsv.github.io/mermaid/" rel="nofollow noreferrer">mermaid</a> diagrams:</p>

<p><a href="https://i.stack.imgur.com/daFOk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/daFOk.png" alt="enter image description here"></a></p>

<p>The extension uses a default stylesheet that works fine if using the light theme. However, if the user has switched Visual Studio Code to use the dark theme, the stylesheet has some rules that are not compatible with the default dark stylesheet:</p>

<p><a href="https://i.stack.imgur.com/83Zbg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/83Zbg.png" alt="enter image description here"></a></p>

<p>Is is possible to detect programmatically the active theme type (e.g. light/dark) so that I could provide a different stylesheet for each case?</p>

<p>I would like to use the stylesheets bundled in mermaid and not craft completely different ones in my extension.</p>