create-gojs-kit
Version:
A CLI for downloading GoJS samples, extensions, and docs
179 lines • 55.7 kB
HTML
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><link rel="stylesheet" href="../../assets/css/style.css"/><link rel="preconnect" href="https://rsms.me/"/><link rel="stylesheet" href="https://rsms.me/inter/inter.css"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>ThemeManager | GoJS API</title><meta name="description" content="Documentation for GoJS API"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><link rel="stylesheet" href="../assets/custom.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script type="text/javascript">// formerly in api.js
var hash = null;
function changeHash() {
var panels = document.getElementsByClassName("tsd-panel");
for (let i = 0; i < panels.length; i++) {
var p = panels[i];
p.classList.remove("targeted");
}
hash = window.location.hash.slice(1);
if (hash) {
var elt = document.getElementById(hash);
if (elt) elt.parentNode.classList.add("targeted");
}
}
document.addEventListener("DOMContentLoaded", changeHash);
window.addEventListener("hashchange", changeHash);</script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header><nav id="navTop" class="w-full h-[var(--topnav-h)] z-30 bg-[var(--color-background-secondary)] border-b border-b-[var(--color-accent)]"><div class="max-w-screen-xl mx-auto flex flex-wrap items-start justify-between px-4"><a class="!text-white bg-nwoods-primary font-bold !leading-[calc(var(--topnav-h)_-_1px)] my-0 px-2 text-4xl lg:text-5xl logo" href="../../index.html">GoJS</a><div class="relative"><button id="topnavButton" class="h-[calc(var(--topnav-h)_-_1px)] px-2 m-0 text-[var(--color-text)] bg-inherit shadow-none md:hidden hover:!bg-inherit hover:!text-nwoods-accent hover:!shadow-none" aria-label="Navigation"><svg class="h-7 w-7 block" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5" stroke-linecap="round" stroke-linejoin="round"></path></svg></button><div id="topnavList" class="hidden md:block"><div class="absolute right-0 z-30 flex flex-col items-end rounded border border-[var(--color-accent)] p-4 pl-12 shadow bg-[var(--color-background-secondary)] text-[var(--color-text)] font-semibold
md:flex-row md:space-x-4 md:items-start md:border-0 md:p-0 md:shadow-none md:!bg-inherit"><a href="../../learn/index.html">Learn</a><a href="../../samples/index.html">Samples</a><a href="../../intro/index.html">Intro</a><a class="active" href="../../api/index.html">API</a><a href="../../download.html">Download</a><a href="https://forum.nwoods.com/c/gojs/11" target="_blank" rel="noopener">Forum</a><a href="https://nwoods.com/contact.html" target="_blank" rel="noopener" id="contactBtn">Contact</a><a href="https://nwoods.com/sales/index.html" target="_blank" rel="noopener" id="buyBtn">Buy</a></div></div></div></div></nav><script>window.addEventListener("DOMContentLoaded", function () {
// topnav
var topButton = document.getElementById("topnavButton");
var topnavList = document.getElementById("topnavList");
if (topButton && topnavList) {
topButton.addEventListener("click", function (e) {
topnavList
.classList
.toggle("hidden");
e.stopPropagation();
});
document.addEventListener("click", function (e) {
// if the clicked element isn't the list, close the list
if (!topnavList.classList.contains("hidden") && !e.target.closest("#topnavList")) {
topButton.click();
}
});
// set active <a> element
// done via active tag below, always API
}
});</script><div class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><div id="tsd-search-help"><code class="!text-lg">/</code> to search</div><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">GoJS API</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><div class="flex w-full max-w-screen-xl mx-auto px-2 items-center justify-between"><div><ul class="tsd-breadcrumb"><li><a href="../index.html">GoJS API</a></li><li><a href="ThemeManager.html">ThemeManager</a></li></ul><h1 class="flex items-center">Class ThemeManager</h1></div><div class="text-xs"><b>GoJS</b>® Diagramming Components<br/>version 3.1.0<br/>by <a href="https://nwoods.com/">Northwoods Software®</a></div></div></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>This class is responsible for managing a Diagram's theming (or multiple Diagrams, if shared).</p>
<p class="box">
For more discussion, see <a href="../../intro/theming.html">Introduction to Theming</a>.
</p>
Your templates can make use of the values held by the current <a href="Theme.html" class="tsd-kind-interface">Theme</a> by calling
<a href="GraphObject.html#theme" class="tsd-kind-method">GraphObject.theme</a> or <a href="GraphObject.html#themeData" class="tsd-kind-method">GraphObject.themeData</a> or <a href="GraphObject.html#themeModel" class="tsd-kind-method">GraphObject.themeModel</a> methods,
or by adding a <a href="ThemeBinding.html" class="tsd-kind-class">ThemeBinding</a> to a GraphObject when using <a href="GraphObject.html#make" class="tsd-kind-method">GraphObject.make</a>.
All theme bindings are OneWay only -- from source data to target GraphObject property.
<p>Use <a href="GraphObject.html#theme" class="tsd-kind-method">GraphObject.theme</a> to look up a value directly from the current Theme.
Use <a href="GraphObject.html#themeData" class="tsd-kind-method">GraphObject.themeData</a> to look up a value in the current Theme based on the value
of a data property.
Use <a href="GraphObject.html#themeModel" class="tsd-kind-method">GraphObject.themeModel</a> to look up a value in the current Theme based on the value
of a data property on the <a href="Model.html#modelData" class="tsd-kind-accessor">Model.modelData</a> shared object.</p>
<p>For example:</p>
<pre><code class="language-js"><span class="hl-4">myDiagram</span><span class="hl-2">.</span><span class="hl-4">nodeTemplate</span><span class="hl-2"> =</span><br/><span class="hl-2"> </span><span class="hl-1">new</span><span class="hl-2"> </span><span class="hl-4">go</span><span class="hl-2">.</span><span class="hl-5">Node</span><span class="hl-2">(</span><span class="hl-6">'Auto'</span><span class="hl-2">).</span><span class="hl-5">add</span><span class="hl-2">(</span><br/><span class="hl-2"> </span><span class="hl-1">new</span><span class="hl-2"> </span><span class="hl-4">go</span><span class="hl-2">.</span><span class="hl-5">Shape</span><span class="hl-2">(</span><span class="hl-6">'RoundedRectangle'</span><span class="hl-2">, { </span><span class="hl-4">strokeWidth:</span><span class="hl-2"> </span><span class="hl-7">2</span><span class="hl-2"> })</span><br/><span class="hl-2"> .</span><span class="hl-5">theme</span><span class="hl-2">(</span><span class="hl-6">'fill'</span><span class="hl-2">, </span><span class="hl-6">'primary'</span><span class="hl-2">) </span><span class="hl-0">// Shape.fill is set to the current theme's colors.primary</span><br/><span class="hl-2"> .</span><span class="hl-5">theme</span><span class="hl-2">(</span><span class="hl-6">'stroke'</span><span class="hl-2">, </span><span class="hl-6">'border'</span><span class="hl-2">), </span><span class="hl-0">// Shape.stroke is set to the current theme's colors.border</span><br/><span class="hl-2"> </span><span class="hl-1">new</span><span class="hl-2"> </span><span class="hl-4">go</span><span class="hl-2">.</span><span class="hl-5">TextBlock</span><span class="hl-2">({ </span><span class="hl-4">margin:</span><span class="hl-2"> </span><span class="hl-7">8</span><span class="hl-2"> })</span><br/><span class="hl-2"> .</span><span class="hl-5">bind</span><span class="hl-2">(</span><span class="hl-6">'text'</span><span class="hl-2">, </span><span class="hl-6">'key'</span><span class="hl-2">)</span><br/><span class="hl-2"> .</span><span class="hl-5">theme</span><span class="hl-2">(</span><span class="hl-6">'stroke'</span><span class="hl-2">, </span><span class="hl-6">'text'</span><span class="hl-2">) </span><span class="hl-0">// stroke color is a dark or light gray</span><br/><span class="hl-2"> );</span>
</code><button>Copy</button></pre>
<p>See <a href="Themes.html" class="tsd-kind-class">Themes</a> for the definitions of the two predefined Themes that are normally used.</p>
<p>There are additional theming resources defined in
<a href="../../extensions/Themes.js">Themes.js</a>
in the extensions or extensionsJSM directories.</p>
</div><div class="tsd-comment-tags tsd-typography"><div class="flex items-center"><code class="tsd-tag">since</code><p>3.0</p>
</div></div></section><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="true" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="ThemeManager.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Accessors</h3><div class="tsd-index-list"><a href="ThemeManager.html#changesDivBackground" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>changes<wbr/>Div<wbr/>Background</span></a>
<a href="ThemeManager.html#currentTheme" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>current<wbr/>Theme</span></a>
<a href="ThemeManager.html#defaultTheme" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>default<wbr/>Theme</span></a>
<a href="ThemeManager.html#preferredColorScheme" class="tsd-index-link"><svg class="readonly tsd-subicon" viewBox="0 0 28 28"><g id="subicon-R,#FF4D4D"><rect fill="var(--color-icon-background)" width="28" height="28" rx="14"></rect><path transform="translate(2, 2)" fill="none" stroke-width="1.5" stroke="var(--color-text)" d="M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z" stroke-linecap="round" stroke-linejoin="round"></path></g></svg><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>preferred<wbr/>Color<wbr/>Scheme</span></a>
<a href="ThemeManager.html#readsCssVariables" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>reads<wbr/>Css<wbr/>Variables</span></a>
<a href="ThemeManager.html#themeMap" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>theme<wbr/>Map</span></a>
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="ThemeManager.html#addDiagram" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Diagram</span></a>
<a href="ThemeManager.html#findTheme" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>find<wbr/>Theme</span></a>
<a href="ThemeManager.html#findValue" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>find<wbr/>Value</span></a>
<a href="ThemeManager.html#getValue" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Value</span></a>
<a href="ThemeManager.html#removeDiagram" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>remove<wbr/>Diagram</span></a>
<a href="ThemeManager.html#set" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set</span></a>
<a href="ThemeManager.html#updateDiagrams" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>update<wbr/>Diagrams</span></a>
</div></section></div></details></section></section><section class="tsd-panel-group tsd-member-group"><h2>Constructors</h2><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="constructor.new_ThemeManager" class="tsd-anchor"></a><span class="tsd-kind-constructor-signature">new <wbr/>Theme<wbr/>Manager</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">init</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="ThemeManager.html" class="tsd-signature-type tsd-kind-class">ThemeManager</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="ThemeManager.html" class="tsd-signature-type tsd-kind-class">ThemeManager</a><a href="#constructor.new_ThemeManager" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Constructs a ThemeManager.</p>
<p>If a <a href="ThemeManager.html#themeMap" class="tsd-kind-accessor">themeMap</a> isn't provided, this gets default <code>light</code> and <code>dark</code> themes
that are copies of <a href="Themes.html#Light" class="tsd-kind-property">Themes.Light</a> and <a href="Themes.html#Dark" class="tsd-kind-property">Themes.Dark</a>, respectively.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">init</span>: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="ThemeManager.html" class="tsd-signature-type tsd-kind-class">ThemeManager</a><span class="tsd-signature-symbol">></span></h5><div class="tsd-comment tsd-typography"><p>Optional initialization properties.</p>
</div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="ThemeManager.html" class="tsd-signature-type tsd-kind-class">ThemeManager</a></h4></li></ul></section></section><section class="tsd-panel-group tsd-member-group"><h2>Accessors</h2><section class="tsd-panel tsd-member"><a id="changesDivBackground" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>changes<wbr/>Div<wbr/>Background</span><div class="membertype"><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></div><a href="#changesDivBackground" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Gets or sets whether this ThemeManager changes the div background color when <a href="ThemeManager.html#currentTheme" class="tsd-kind-accessor">currentTheme</a> changes.</p>
<p>If true, the background color will be set to the CSS color string denoted by the <code>div</code> property
of the <a href="Theme.html#colors" class="tsd-kind-property">Theme.colors</a> object.</p>
</div><div class="tsd-comment-tags tsd-typography"><div class="flex items-center"><code class="tsd-tag">defaultValue</code><p><code>false</code></p>
</div></div></li></ul></section><section class="tsd-panel tsd-member"><a id="currentTheme" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>current<wbr/>Theme</span><div class="membertype"><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></div><a href="#currentTheme" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Gets or sets the current theme for this ThemeManager.</p>
<p>A value of <code>system</code> will rely on the browser's preferred color scheme,
using <code>light</code> or <code>dark</code> themes.</p>
</div><div class="tsd-comment-tags tsd-typography"><div class="flex items-center"><code class="tsd-tag">defaultValue</code><p><code>light</code></p>
</div></div></li></ul></section><section class="tsd-panel tsd-member"><a id="defaultTheme" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>default<wbr/>Theme</span><div class="membertype"><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></div><a href="#defaultTheme" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Gets or sets the default theme for this ThemeManager.</p>
<p>This property determines which theme is used as a fallback if a lookup
doesn't find a value in the current theme.</p>
</div><div class="tsd-comment-tags tsd-typography"><div class="flex items-center"><code class="tsd-tag">defaultValue</code><p><code>light</code></p>
</div></div></li></ul></section><section class="tsd-panel tsd-member"><a id="preferredColorScheme" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagReadOnly">Readonly</code><span>preferred<wbr/>Color<wbr/>Scheme</span><div class="membertype"><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">"light"</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">"dark"</span></div><a href="#preferredColorScheme" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>This read-only property returns the user's preferred color scheme,
useful when <a href="ThemeManager.html#currentTheme" class="tsd-kind-accessor">currentTheme</a> is set to <code>system</code>.</p>
<p>See <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme">https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme</a>.</p>
</div></li></ul></section><section class="tsd-panel tsd-member"><a id="readsCssVariables" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>reads<wbr/>Css<wbr/>Variables</span><div class="membertype"><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></div><a href="#readsCssVariables" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Gets or sets whether this ThemeManager reads var(...) values via <code>getComputedStyle</code> and <code>getPropertyValue</code>.</p>
<p>The values will be read from the :root CSS element.
This may be especially useful if you need to reference CSS variables from another library,
or if you've defined CSS variables that are used to theme the rest of your application.</p>
<p>The CSS variable's value will be read before any <a href="ThemeBinding.html#themeConverter" class="tsd-kind-accessor">ThemeBinding.themeConverter</a> functions have run.</p>
<p class="box">
NOTE: The syntax to reference a CSS variable in a theme is <code>'var(<varname>)'</code>.
Only a single variable may be referenced, and any fallbacks should be defined either on the template or
in the referenced CSS variable.
</p>
<p>CSS:</p>
<pre><code class="language-css"><span class="hl-16">:root</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-12">--color-bg</span><span class="hl-2">: </span><span class="hl-5">var</span><span class="hl-2">(</span><span class="hl-12">--color-slate-50</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-12">--color-primary</span><span class="hl-2">: </span><span class="hl-5">var</span><span class="hl-2">(</span><span class="hl-12">--color-emerald-300</span><span class="hl-2">);</span><br/><span class="hl-2">}</span><br/><br/><span class="hl-16">.dark</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-12">--color-bg</span><span class="hl-2">: </span><span class="hl-5">var</span><span class="hl-2">(</span><span class="hl-12">--color-slate-950</span><span class="hl-2">);</span><br/><span class="hl-2"> </span><span class="hl-12">--color-primary</span><span class="hl-2">: </span><span class="hl-5">var</span><span class="hl-2">(</span><span class="hl-12">--color-emerald-700</span><span class="hl-2">);</span><br/><span class="hl-2">}</span>
</code><button>Copy</button></pre>
<p>ThemeManager:</p>
<pre><code class="language-js"><span class="hl-0">// using a single theme</span><br/><span class="hl-4">diagram</span><span class="hl-2">.</span><span class="hl-4">themeManager</span><span class="hl-2"> = </span><span class="hl-1">new</span><span class="hl-2"> </span><span class="hl-4">go</span><span class="hl-2">.</span><span class="hl-5">ThemeManager</span><span class="hl-2">({</span><br/><span class="hl-2"> </span><span class="hl-4">changesDivBackground:</span><span class="hl-2"> </span><span class="hl-1">true</span><span class="hl-2">, </span><span class="hl-0">// may not be needed in cases where the diagram background is transparent</span><br/><span class="hl-2"> </span><span class="hl-4">defaultTheme:</span><span class="hl-2"> </span><span class="hl-6">'default'</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">currentTheme:</span><span class="hl-2"> </span><span class="hl-6">'default'</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">themeMap:</span><span class="hl-2"> </span><span class="hl-1">new</span><span class="hl-2"> </span><span class="hl-4">go</span><span class="hl-2">.</span><span class="hl-5">Map</span><span class="hl-2">([</span><br/><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-4">key:</span><span class="hl-2"> </span><span class="hl-6">'default'</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">value:</span><span class="hl-2"> {</span><br/><span class="hl-2"> ...</span><span class="hl-4">go</span><span class="hl-2">.</span><span class="hl-4">Themes</span><span class="hl-2">.</span><span class="hl-4">Dark</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">colors:</span><span class="hl-2"> {</span><br/><span class="hl-2"> ...</span><span class="hl-4">go</span><span class="hl-2">.</span><span class="hl-4">Themes</span><span class="hl-2">.</span><span class="hl-4">Dark</span><span class="hl-2">.</span><span class="hl-4">colors</span><span class="hl-2">, </span><span class="hl-0">// take some default colors from the built-in dark theme</span><br/><span class="hl-2"> </span><span class="hl-4">div:</span><span class="hl-2"> </span><span class="hl-6">'var(--color-bg)'</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">primary:</span><span class="hl-2"> </span><span class="hl-6">'var(--color-primary)'</span><br/><span class="hl-2"> }</span><br/><span class="hl-2"> }</span><br/><span class="hl-2"> }</span><br/><span class="hl-2"> ])</span><br/><span class="hl-2">});</span><br/><br/><span class="hl-0">// using multiple themes</span><br/><span class="hl-4">diagram</span><span class="hl-2">.</span><span class="hl-4">themeManager</span><span class="hl-2"> = </span><span class="hl-1">new</span><span class="hl-2"> </span><span class="hl-4">go</span><span class="hl-2">.</span><span class="hl-5">ThemeManager</span><span class="hl-2">({</span><br/><span class="hl-2"> </span><span class="hl-4">changesDivBackground:</span><span class="hl-2"> </span><span class="hl-1">true</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">themeMap:</span><span class="hl-2"> </span><span class="hl-1">new</span><span class="hl-2"> </span><span class="hl-4">go</span><span class="hl-2">.</span><span class="hl-5">Map</span><span class="hl-2">([</span><br/><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-4">key:</span><span class="hl-2"> </span><span class="hl-6">'light'</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">value:</span><span class="hl-2"> {</span><br/><span class="hl-2"> ...</span><span class="hl-4">go</span><span class="hl-2">.</span><span class="hl-4">Themes</span><span class="hl-2">.</span><span class="hl-4">Light</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">colors:</span><span class="hl-2"> {</span><br/><span class="hl-2"> ...</span><span class="hl-4">go</span><span class="hl-2">.</span><span class="hl-4">Themes</span><span class="hl-2">.</span><span class="hl-4">Light</span><span class="hl-2">.</span><span class="hl-4">colors</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">div:</span><span class="hl-2"> </span><span class="hl-6">'var(--color-slate-50)'</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">primary:</span><span class="hl-2"> </span><span class="hl-6">'var(--color-emerald-300)'</span><br/><span class="hl-2"> }</span><br/><span class="hl-2"> }</span><br/><span class="hl-2"> },</span><br/><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-4">key:</span><span class="hl-2"> </span><span class="hl-6">'dark'</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">value:</span><span class="hl-2"> {</span><br/><span class="hl-2"> ...</span><span class="hl-4">go</span><span class="hl-2">.</span><span class="hl-4">Themes</span><span class="hl-2">.</span><span class="hl-4">Dark</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">colors:</span><span class="hl-2"> {</span><br/><span class="hl-2"> ...</span><span class="hl-4">go</span><span class="hl-2">.</span><span class="hl-4">Themes</span><span class="hl-2">.</span><span class="hl-4">Dark</span><span class="hl-2">.</span><span class="hl-4">colors</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">div:</span><span class="hl-2"> </span><span class="hl-6">'var(--color-slate-900)'</span><span class="hl-2">,</span><br/><span class="hl-2"> </span><span class="hl-4">primary:</span><span class="hl-2"> </span><span class="hl-6">'var(--color-emerald-700)'</span><br/><span class="hl-2"> }</span><br/><span class="hl-2"> }</span><br/><span class="hl-2"> }</span><br/><span class="hl-2"> ])</span><br/><span class="hl-2">});</span>
</code><button>Copy</button></pre>
<p>Switching themes:</p>
<pre><code><span class="hl-0">// on theme change, set :root class and update diagrams</span><br/><span class="hl-0">// not strictly needed if using two themes</span><br/><span class="hl-4">document</span><span class="hl-2">.</span><span class="hl-4">documentElement</span><span class="hl-2">.</span><span class="hl-4">classList</span><span class="hl-2">.</span><span class="hl-5">toggle</span><span class="hl-2">(</span><span class="hl-6">'dark'</span><span class="hl-2">, ...);</span><br/><br/><span class="hl-0">// using a single theme</span><br/><span class="hl-4">themeManager</span><span class="hl-2">.</span><span class="hl-5">updateDiagrams</span><span class="hl-2">();</span><br/><br/><span class="hl-0">// using multiple themes</span><br/><span class="hl-4">themeManager</span><span class="hl-2">.</span><span class="hl-4">currentTheme</span><span class="hl-2"> = </span><span class="hl-4">mode</span><span class="hl-2">;</span><br/>
</code><button>Copy</button></pre>
<p>See <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle">getComputedStyle</a> and
<a href="https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleDeclaration/getPropertyValue">getPropertyValue</a>
for more information on reading CSS from JS.</p>
</div><div class="tsd-comment-tags tsd-typography"><div class="flex items-center"><code class="tsd-tag">defaultValue</code><p><code>true</code></p>
</div><div class="flex items-center"><code class="tsd-tag">since</code><p>3.1</p>
</div></div></li></ul></section><section class="tsd-panel tsd-member"><a id="themeMap" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>theme<wbr/>Map</span><div class="membertype"><span class="tsd-signature-symbol">: </span><a href="Map.html" class="tsd-signature-type tsd-kind-class">Map</a><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">, </span><a href="Theme.html" class="tsd-signature-type tsd-kind-interface">Theme</a><span class="tsd-signature-symbol">></span></div><a href="#themeMap" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Gets or sets the map of theme names -> Themes for this ThemeManager.</p>
</div></li></ul></section></section><section class="tsd-panel-group tsd-member-group"><h2>Methods</h2><section class="tsd-panel tsd-member"><a id="addDiagram" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>add<wbr/>Diagram</span><a href="#addDiagram" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="addDiagram.addDiagram-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">add<wbr/>Diagram</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">diagram</span><span class="tsd-signature-symbol">: </span><a href="Diagram.html" class="tsd-signature-type tsd-kind-class">Diagram</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#addDiagram.addDiagram-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Make sure this ThemeManager knows about a <a href="Diagram.html" class="tsd-kind-class">Diagram</a> for which it should handle theming.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><h5><span class="tsd-kind-parameter">diagram</span>: <a href="Diagram.html" class="tsd-signature-type tsd-kind-class">Diagram</a></h5><div class="tsd-comment tsd-typography"><p>A <a href="Diagram.html" class="tsd-kind-class">Diagram</a> that this ThemeManager is theming.</p>
</div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><p>this</p>
<div class="tsd-comment-tags tsd-typography"><div class="flex items-center"><code class="tsd-tag">see</code><p><a href="ThemeManager.html#removeDiagram" class="tsd-kind-method">removeDiagram</a></p>
</div></div></li></ul></section><section class="tsd-panel tsd-member"><a id="findTheme" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>find<wbr/>Theme</span><a href="#findTheme" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="findTheme.findTheme-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>Theme</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">themeName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="Theme.html" class="tsd-signature-type tsd-kind-interface">Theme</a><a href="#findTheme.findTheme-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Finds the <a href="Theme.html" class="tsd-kind-interface">Theme</a> with the specified name, or if the name is <code>system</code>, the preferred <code>light</code> or <code>dark</code> theme.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><h5><span class="tsd-kind-parameter">themeName</span>: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>the theme name to get from <a href="ThemeManager.html#themeMap" class="tsd-kind-accessor">themeMap</a></p>
</div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="Theme.html" class="tsd-signature-type tsd-kind-interface">Theme</a></h4><p>a Theme, or undefined if the Theme was not found</p>
</li></ul></section><section class="tsd-panel tsd-member"><a id="findValue" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagVirtual">Virtual</code><span>find<wbr/>Value</span><a href="#findValue" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="findValue.findValue-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">find<wbr/>Value</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">prop</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span>, <span class="tsd-kind-parameter">source</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span>, <span class="tsd-kind-parameter">tprop</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><a href="#findValue.findValue-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Finds a value in this ThemeManager's themes.</p>
<p>By default, this first looks in the <a href="ThemeManager.html#currentTheme" class="tsd-kind-accessor">currentTheme</a>, then the <a href="ThemeManager.html#defaultTheme" class="tsd-kind-accessor">defaultTheme</a>.
Because <a href="ThemeManager.html#findTheme" class="tsd-kind-method">findTheme</a> is called, this method also handles <a href="ThemeManager.html#currentTheme" class="tsd-kind-accessor">currentTheme</a> being <code>system</code>.</p>
<p>The default implementation is:</p>
<pre><code class="language-js"><span class="hl-8">return</span><span class="hl-2"> </span><span class="hl-1">this</span><span class="hl-2">.</span><span class="hl-5">getValue</span><span class="hl-2">(</span><span class="hl-1">this</span><span class="hl-2">.</span><span class="hl-5">findTheme</span><span class="hl-2">(</span><span class="hl-1">this</span><span class="hl-2">.</span><span class="hl-4">currentTheme</span><span class="hl-2">), </span><span class="hl-4">prop</span><span class="hl-2">, </span><span class="hl-4">source</span><span class="hl-2">, </span><span class="hl-4">tprop</span><span class="hl-2">) || </span><span class="hl-1">this</span><span class="hl-2">.</span><span class="hl-5">getValue</span><span class="hl-2">(</span><span class="hl-1">this</span><span class="hl-2">.</span><span class="hl-5">findTheme</span><span class="hl-2">(</span><span class="hl-1">this</span><span class="hl-2">.</span><span class="hl-4">defaultTheme</span><span class="hl-2">), </span><span class="hl-4">prop</span><span class="hl-2">, </span><span class="hl-4">source</span><span class="hl-2">, </span><span class="hl-4">tprop</span><span class="hl-2">);</span>
</code><button>Copy</button></pre>
<p>This method may be overridden to search Themes in different orders.
Please read the Introduction page on <a href="../../intro/extensions.html">Extensions</a> for how to override methods and how to call this base method.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><h5><span class="tsd-kind-parameter">prop</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><p>a property to search for in the Theme,
also accepting '.'-separated paths, an array of strings representing a path, or an index to an array element</p>
</div></li><li><h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><p>where to perform the lookup within the Theme object</p>
</div></li><li><h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">tprop</span>: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>an optional target property name, used if a full path is not provided,
which can determine the property on the Theme object to search via <a href="Theme.html#targetPropertyMap" class="tsd-kind-property">Theme.targetPropertyMap</a></p>
</div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4><p>the value found, or undefined if not found</p>
</li></ul></section><section class="tsd-panel tsd-member"><a id="getValue" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagVirtual">Virtual</code><span>get<wbr/>Value</span><a href="#getValue" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="getValue.getValue-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">get<wbr/>Value</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">theme</span><span class="tsd-signature-symbol">: </span><a href="Theme.html" class="tsd-signature-type tsd-kind-interface">Theme</a>, <span class="tsd-kind-parameter">prop</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span>, <span class="tsd-kind-parameter">source</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span>, <span class="tsd-kind-parameter">tprop</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">any</span><a href="#getValue.getValue-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Gets a value from the given Theme.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><h5><span class="tsd-kind-parameter">theme</span>: <a href="Theme.html" class="tsd-signature-type tsd-kind-interface">Theme</a></h5><div class="tsd-comment tsd-typography"><p>the Theme to search</p>
</div></li><li><h5><span class="tsd-kind-parameter">prop</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><p>a property to search for in the Theme,
also accepting '.'-separated paths, an array of strings representing a path, or an index to an array element</p>
</div></li><li><h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">source</span>: <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><p>where to perform the lookup within the Theme object</p>
</div></li><li><h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">tprop</span>: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>an optional target property name, used if a full path is not provided,
which can determine the property on the Theme object to search via <a href="Theme.html#targetPropertyMap" class="tsd-kind-property">Theme.targetPropertyMap</a></p>
</div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4><p>the value in the given Theme, or undefined if not found</p>
</li></ul></section><section class="tsd-panel tsd-member"><a id="removeDiagram" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>remove<wbr/>Diagram</span><a href="#removeDiagram" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="removeDiagram.removeDiagram-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">remove<wbr/>Diagram</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">diagram</span><span class="tsd-signature-symbol">: </span><a href="Diagram.html" class="tsd-signature-type tsd-kind-class">Diagram</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#removeDiagram.removeDiagram-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Inform this ThemeManager that it will no longer handle theming for a given diagram.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><h5><span class="tsd-kind-parameter">diagram</span>: <a href="Diagram.html" class="tsd-signature-type tsd-kind-class">Diagram</a></h5><div class="tsd-comment tsd-typography"><p>A <a href="Diagram.html" class="tsd-kind-class">Diagram</a> that this ThemeManager should no longer theme.</p>
</div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><p>this</p>
<div class="tsd-comment-tags tsd-typography"><div class="flex items-center"><code class="tsd-tag">see</code><p><a href="ThemeManager.html#addDiagram" class="tsd-kind-method">addDiagram</a></p>
</div></div></li></ul></section><section class="tsd-panel tsd-member"><a id="set" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>set</span><a href="#set" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="set.set-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">set</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">themeName</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, <span class="tsd-kind-parameter">props</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="Theme.html" class="tsd-signature-type tsd-kind-interface">Theme</a><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">this</span><a href="#set.set-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Set a particular theme and update all associated theme bindings.
Note that this will modify the named Theme object via a merge if it exists.</p>
<p>If passed <code>system</code>, this method will create/update the <a href="ThemeManager.html#preferredColorScheme" class="tsd-kind-accessor">preferredColorScheme</a> theme.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><h5><span class="tsd-kind-parameter">themeName</span>: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>which theme to change, or the empty string to update the default theme</p>
</div></li><li><h5><span class="tsd-kind-parameter">props</span>: <span class="tsd-signature-type">Partial</span><span class="tsd-signature-symbol"><</span><a href="Theme.html" class="tsd-signature-type tsd-kind-interface">Theme</a><span class="tsd-signature-symbol">></span></h5><div class="tsd-comment tsd-typography"><p>a partial Theme object to merge into the given theme or add as a new theme</p>
</div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">this</span></h4><p>this</p>
</li></ul></section><section class="tsd-panel tsd-member"><a id="updateDiagrams" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>update<wbr/>Diagrams</span><a href="#updateDiagrams" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="updateDiagrams.updateDiagrams-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">update<wbr/>Diagrams</span><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#updateDiagrams.updateDiagrams-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Updates all theme bindings and backgrounds for diagrams associated with this ThemeManager.</p>
<p>You should only need to call this if referencing CSS variables that may change.</p>
</div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment-tags tsd-typography"><div class="flex items-center"><code class="tsd-tag">see</code><p><a href="ThemeManager.html#readsCssVariables" class="tsd-kind-accessor">readsCssVariables</a></p>
</div><div class="flex items-center"><code class="tsd-tag">since</code><p>3.1</p>
</div></div></li></ul></section></section></div><div class="col-sidebar"><div class="page-menu"><details open class="tsd-index-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><ul><li><a href="#constructor"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></li><li><a href="#changesDivBackground"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>changes<wbr/>Div<wbr/>Background</span></a></li><li><a href="#currentTheme"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>current<wbr/>Theme</span></a></li><li><a href="#defaultTheme"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>default<wbr/>Theme</span></a></li><li><a href="#preferredColorScheme"><svg class="readonly tsd-subicon" viewBox="0 0 28 28"><use href="#subicon-R,#FF4D4D"></use></svg><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>preferred<wbr/>Color<wbr/>Scheme</span></a></li><li><a href="#readsCssVariables"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>reads<wbr/>Css<wbr/>Variables</span></a></li><li><a href="#themeMap"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-262144"></use></svg><span>theme<wbr/>Map</span></a></li><li><a href="#addDiagram"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>add<wbr/>Diagram</span></a></li><li><a href="#findTheme"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>find<wbr/>Theme</span></a></li><li><a href="#findValue"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>find<wbr/>Value</span></a></li><li><a href="#getValue"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>get<wbr/>Value</span></a></li><li><a href="#removeDiagram"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>remove<wbr/>Diagram</span></a></li><li><a href="#set"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set</span></a></li><li><a href="#updateDiagrams"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>update<wbr/>Diagrams</span></a></li></ul></div></details><div class="tsd-navigation settings"><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">System</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../index.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>GoJS API</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><div class="tsd w-full max-w-screen-xl mx-auto px-2"><div class="bottom-copyright">Copyright © 1998-2025 by Northwoods Software Corporation.</div></div><div class="overlay"></div><script async src="https://www.googletagmanager.com/gtag/js?id=G-S5QK8VSK84"></script><script>window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-S5QK8VSK84');
var getOutboundLink = function(url, label) {
gtag('event', 'click', {
'event_category': 'outbound',
'event_label': label,
'transport_type': 'beacon'
});
}
document.getElementById("contactBtn").addEventListener("click", function() {
getOutboundLink('https://nwoods.com/contact.html', 'contact');
});
document.getElementById("buyBtn").addEventListener("click", function() {
getOutboundLink('https://nwoods.com/sales/index.html', 'buy');
});</script></body></html>