@opendata-ai/openchart-vanilla 2.8.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2566,12 +2566,21 @@ function createGraph(container, spec, options) {
2566
2566
  const { width, height } = getContainerDimensions();
2567
2567
  const isDark = resolveDarkMode(options?.darkMode);
2568
2568
  wrapper = document.createElement("div");
2569
- wrapper.className = "viz-graph-wrapper";
2569
+ wrapper.className = isDark ? "viz-graph-wrapper viz-dark" : "viz-graph-wrapper";
2570
2570
  if (isDark) {
2571
2571
  container.classList.add("viz-dark");
2572
2572
  } else {
2573
2573
  container.classList.remove("viz-dark");
2574
2574
  }
2575
+ const resolvedTheme = compilation.theme;
2576
+ if (resolvedTheme) {
2577
+ const s = wrapper.style;
2578
+ s.setProperty("--viz-bg", resolvedTheme.colors.background);
2579
+ s.setProperty("--viz-text", resolvedTheme.colors.text);
2580
+ s.setProperty("--viz-text-secondary", resolvedTheme.colors.axis ?? resolvedTheme.colors.text);
2581
+ s.setProperty("--viz-font-family", resolvedTheme.fonts.family);
2582
+ s.fontFamily = resolvedTheme.fonts.family;
2583
+ }
2575
2584
  chromeEl = document.createElement("div");
2576
2585
  chromeEl.className = "viz-graph-chrome";
2577
2586
  renderChrome2();