@opendata-ai/openchart-core 7.0.0 → 7.0.3
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.d.ts +2 -0
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/theme/dark-mode.ts +11 -8
- package/src/types/spec.ts +2 -0
package/package.json
CHANGED
package/src/theme/dark-mode.ts
CHANGED
|
@@ -106,17 +106,20 @@ function _luminanceFromHex(color: string): number {
|
|
|
106
106
|
*/
|
|
107
107
|
export function adaptTheme(theme: ResolvedTheme): ResolvedTheme {
|
|
108
108
|
const inputBg = theme.colors.background;
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
// "transparent" preserves the background token but must still adopt dark
|
|
110
|
+
// text/gridline/axis colors — the container is dark, not the chart canvas.
|
|
111
|
+
const isTransparent = inputBg === 'transparent';
|
|
112
|
+
const alreadyDark = isTransparent || _luminanceFromHex(inputBg) < 0.2;
|
|
113
|
+
|
|
114
|
+
// Preserve user-supplied background (including transparent) but always
|
|
115
|
+
// apply dark-mode text/axis/gridline colors so labels are readable on the
|
|
116
|
+
// dark host surface.
|
|
114
117
|
const darkBg = alreadyDark ? inputBg : DARK_BG;
|
|
115
|
-
const darkText =
|
|
116
|
-
const darkGridline =
|
|
118
|
+
const darkText = DARK_TEXT;
|
|
119
|
+
const darkGridline = 'rgba(255,255,255,0.05)';
|
|
117
120
|
// axis is also tick-label fill — needs WCAG AA contrast on dark bg.
|
|
118
121
|
// Zinc-400 (`#a1a1aa`) hits ~6:1 against #09090b.
|
|
119
|
-
const darkAxis =
|
|
122
|
+
const darkAxis = '#a1a1aa';
|
|
120
123
|
const darkMuted = ACHROMATIC_RAMP.fgMuted;
|
|
121
124
|
|
|
122
125
|
// Categorical palette is pinned to design-system tokens. The same vibrant
|
package/src/types/spec.ts
CHANGED
|
@@ -1502,6 +1502,8 @@ export interface LayerSpec<TData extends DataRow = DataRow> {
|
|
|
1502
1502
|
resolve?: ResolveConfig;
|
|
1503
1503
|
/** Hidden series names. */
|
|
1504
1504
|
hiddenSeries?: string[];
|
|
1505
|
+
/** Endpoint labels column, inherited by child layers that don't set their own. */
|
|
1506
|
+
endpointLabels?: boolean | EndpointLabelsConfig;
|
|
1505
1507
|
/** Animation configuration. */
|
|
1506
1508
|
animation?: AnimationSpec;
|
|
1507
1509
|
}
|