@opendata-ai/openchart-engine 7.7.0 → 7.8.0

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
@@ -14782,6 +14782,7 @@ import {
14782
14782
  computeChrome as computeChrome7,
14783
14783
  estimateTextWidth as estimateTextWidth20,
14784
14784
  formatNumber as formatNumber8,
14785
+ pickLabelColor as pickLabelColor2,
14785
14786
  resolveTheme as resolveTheme5,
14786
14787
  SEQUENTIAL_PALETTES
14787
14788
  } from "@opendata-ai/openchart-core";
@@ -14897,7 +14898,8 @@ function compileQuantitative(tilemapSpec, options, theme, chrome, fullArea, isDa
14897
14898
  value: value2,
14898
14899
  formattedValue,
14899
14900
  hasData,
14900
- theme
14901
+ theme,
14902
+ isDarkMode: !!isDarkMode
14901
14903
  })
14902
14904
  );
14903
14905
  }
@@ -15024,6 +15026,7 @@ function compileCategorical(tilemapSpec, options, theme, chrome, fullArea, isDar
15024
15026
  formattedValue,
15025
15027
  hasData,
15026
15028
  theme,
15029
+ isDarkMode: !!isDarkMode,
15027
15030
  category: hasData ? category : void 0
15028
15031
  })
15029
15032
  );
@@ -15096,22 +15099,25 @@ function buildTileMark(opts) {
15096
15099
  formattedValue,
15097
15100
  hasData,
15098
15101
  theme,
15102
+ isDarkMode,
15099
15103
  category
15100
15104
  } = opts;
15101
15105
  const tileCenterX = gridOffsetX + pos.x + tileSize / 2;
15102
15106
  const tileTopY = gridOffsetY + pos.y;
15107
+ const textColor = hasData ? pickLabelColor2(fill, isDarkMode) : "#ffffff";
15108
+ const isLightText = textColor === "#ffffff";
15103
15109
  const labelStyle = {
15104
15110
  fontFamily: theme.fonts.family,
15105
15111
  fontSize: tileSize > 24 ? 10 : 7,
15106
15112
  fontWeight: 700,
15107
- fill: "#ffffff",
15113
+ fill: textColor,
15108
15114
  lineHeight: 1.2
15109
15115
  };
15110
15116
  const valueLabelStyle = {
15111
15117
  fontFamily: theme.fonts.family,
15112
15118
  fontSize: tileSize > 24 ? 10 : 7,
15113
15119
  fontWeight: 300,
15114
- fill: "rgba(255,255,255,0.6)",
15120
+ fill: isLightText ? "rgba(255,255,255,0.6)" : "rgba(0,0,0,0.45)",
15115
15121
  lineHeight: 1.2
15116
15122
  };
15117
15123
  const valueLabel = tileSize < 24 ? { text: "", x: 0, y: 0, style: valueLabelStyle, visible: false } : {
@@ -16433,7 +16439,7 @@ function compileFaceted(chartSpec, renderSpec, facetChannel, options, theme, str
16433
16439
  encoding: panelEnc
16434
16440
  };
16435
16441
  const panelScales = computeScales(panelSpecWithDomains, gridPanel.area, panelData);
16436
- applyColorScaleRange(panelScales, panelSpecWithDomains.encoding, theme);
16442
+ applyColorScaleRange(panelScales, panelSpecWithDomains.encoding, theme, renderSpec.highlight);
16437
16443
  panelScales.defaultColor = chartSpec.markDef.fill ?? chartSpec.markDef.stroke ?? theme.colors.categorical[0];
16438
16444
  const isLeftCol = gridPanel.col === 0;
16439
16445
  const isBottomRow = gridPanel.row === grid.rows - 1;