Skip to content

Commit 29f007b

Browse files
authored
fix: charts colors (#1592)
1 parent dfab25c commit 29f007b

File tree

1 file changed

+11
-1
lines changed
  • src/unfold/static/unfold/js

1 file changed

+11
-1
lines changed

src/unfold/static/unfold/js/app.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,17 @@ const renderCharts = () => {
533533
for (const key in parsedData.datasets) {
534534
const dataset = parsedData.datasets[key];
535535
const processColor = (colorProp) => {
536-
if (dataset?.[colorProp]?.startsWith("var(")) {
536+
if (Array.isArray(dataset?.[colorProp])) {
537+
for (const [index, prop] of dataset?.[colorProp].entries()) {
538+
if (prop.startsWith("var(")) {
539+
const cssVar = prop.match(/var\((.*?)\)/)[1];
540+
const color = getComputedStyle(document.documentElement)
541+
.getPropertyValue(cssVar)
542+
.trim();
543+
dataset[colorProp][index] = color;
544+
}
545+
}
546+
} else if (dataset?.[colorProp]?.startsWith("var(")) {
537547
const cssVar = dataset[colorProp].match(/var\((.*?)\)/)[1];
538548
const color = getComputedStyle(document.documentElement)
539549
.getPropertyValue(cssVar)

0 commit comments

Comments
 (0)