@datalayer/primer-addons 1.0.8 → 1.0.9
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/lib/components/overlay/Overlay.js +15 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -0
- package/lib/theme/DatalayerBrandThemeProvider.d.ts +41 -0
- package/lib/theme/DatalayerBrandThemeProvider.js +32 -0
- package/lib/theme/DatalayerThemeProvider.d.ts +36 -0
- package/lib/theme/DatalayerThemeProvider.js +35 -0
- package/lib/theme/Palette.d.ts +4 -0
- package/lib/theme/Palette.js +10 -0
- package/lib/theme/colors/datalayerColors.d.ts +15 -0
- package/lib/theme/colors/datalayerColors.js +21 -0
- package/lib/theme/colors/index.d.ts +4 -0
- package/lib/theme/colors/index.js +8 -0
- package/lib/theme/colors/lovelyColors.d.ts +15 -0
- package/lib/theme/colors/lovelyColors.js +21 -0
- package/lib/theme/colors/matrixColors.d.ts +20 -0
- package/lib/theme/colors/matrixColors.js +26 -0
- package/lib/theme/colors/spatialColors.d.ts +15 -0
- package/lib/theme/colors/spatialColors.js +21 -0
- package/lib/theme/index.d.ts +11 -0
- package/lib/theme/index.js +15 -0
- package/lib/theme/themes/createThemeCSSVars.d.ts +131 -0
- package/lib/theme/themes/createThemeCSSVars.js +172 -0
- package/lib/theme/themes/datalayerTheme.d.ts +1093 -0
- package/lib/theme/themes/datalayerTheme.js +191 -0
- package/lib/theme/themes/lovelyTheme.d.ts +1093 -0
- package/lib/theme/themes/lovelyTheme.js +190 -0
- package/lib/theme/themes/matrixTheme.d.ts +1093 -0
- package/lib/theme/themes/matrixTheme.js +190 -0
- package/lib/theme/themes/spatialTheme.d.ts +1093 -0
- package/lib/theme/themes/spatialTheme.js +190 -0
- package/lib/theme/themes-brand/index.d.ts +1 -0
- package/lib/theme/themes-brand/index.js +5 -0
- package/lib/theme/themes-brand/spatialBrandTheme.d.ts +16 -0
- package/lib/theme/themes-brand/spatialBrandTheme.js +157 -0
- package/lib/theme/useSystemColorMode.d.ts +9 -0
- package/lib/theme/useSystemColorMode.js +26 -0
- package/package.json +1 -1
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Spatial Theme for Primer React.
|
|
7
|
+
*
|
|
8
|
+
* Cosmic indigo & deep blues — inspired by space.
|
|
9
|
+
* Theming is applied via **CSS custom-property overrides**.
|
|
10
|
+
*/
|
|
11
|
+
import { theme as primerTheme } from '@primer/react';
|
|
12
|
+
import { spatialColors } from '../colors';
|
|
13
|
+
import { buildThemeStyles } from './createThemeCSSVars';
|
|
14
|
+
// Re-export so existing consumers keep working.
|
|
15
|
+
export { spatialColors };
|
|
16
|
+
/* ── Light-mode colour definitions ───────────────────────────────────── */
|
|
17
|
+
const spatialLight = {
|
|
18
|
+
canvas: {
|
|
19
|
+
default: spatialColors.white,
|
|
20
|
+
},
|
|
21
|
+
fg: {
|
|
22
|
+
default: '#1E1E3F',
|
|
23
|
+
muted: spatialColors.gray,
|
|
24
|
+
onEmphasis: spatialColors.white,
|
|
25
|
+
},
|
|
26
|
+
accent: {
|
|
27
|
+
fg: spatialColors.indigoText,
|
|
28
|
+
emphasis: spatialColors.indigoBrand,
|
|
29
|
+
muted: spatialColors.indigoAccent,
|
|
30
|
+
},
|
|
31
|
+
success: {
|
|
32
|
+
fg: spatialColors.indigoText,
|
|
33
|
+
emphasis: spatialColors.indigoBrand,
|
|
34
|
+
muted: spatialColors.indigoAccent,
|
|
35
|
+
},
|
|
36
|
+
btn: {
|
|
37
|
+
text: '#1E1E3F',
|
|
38
|
+
bg: spatialColors.white,
|
|
39
|
+
border: '#C7D2FE',
|
|
40
|
+
hoverBg: spatialColors.indigoTint,
|
|
41
|
+
hoverBorder: spatialColors.gray,
|
|
42
|
+
activeBg: spatialColors.indigoTint,
|
|
43
|
+
activeBorder: spatialColors.gray,
|
|
44
|
+
selectedBg: spatialColors.white,
|
|
45
|
+
counterBg: spatialColors.gray,
|
|
46
|
+
primary: {
|
|
47
|
+
text: spatialColors.white,
|
|
48
|
+
bg: spatialColors.indigoText,
|
|
49
|
+
border: spatialColors.indigoText,
|
|
50
|
+
hoverBg: spatialColors.indigoHover,
|
|
51
|
+
hoverBorder: spatialColors.indigoHover,
|
|
52
|
+
selectedBg: spatialColors.indigoHover,
|
|
53
|
+
disabledText: 'rgba(255, 255, 255, 0.8)',
|
|
54
|
+
disabledBg: '#B4B0D8',
|
|
55
|
+
disabledBorder: '#B4B0D8',
|
|
56
|
+
icon: spatialColors.white,
|
|
57
|
+
counterBg: 'rgba(0, 0, 0, 0.2)',
|
|
58
|
+
},
|
|
59
|
+
outline: {
|
|
60
|
+
text: spatialColors.indigoText,
|
|
61
|
+
hoverText: spatialColors.white,
|
|
62
|
+
hoverBg: spatialColors.indigoText,
|
|
63
|
+
hoverBorder: spatialColors.indigoText,
|
|
64
|
+
hoverCounterBg: 'rgba(255, 255, 255, 0.2)',
|
|
65
|
+
selectedText: spatialColors.white,
|
|
66
|
+
selectedBg: spatialColors.indigoHover,
|
|
67
|
+
selectedBorder: spatialColors.indigoHover,
|
|
68
|
+
disabledText: spatialColors.gray,
|
|
69
|
+
disabledBg: spatialColors.indigoTint,
|
|
70
|
+
disabledCounterBg: 'rgba(0, 0, 0, 0.05)',
|
|
71
|
+
counterBg: 'rgba(0, 0, 0, 0.05)',
|
|
72
|
+
counterFg: spatialColors.indigoText,
|
|
73
|
+
hoverCounterFg: spatialColors.white,
|
|
74
|
+
disabledCounterFg: spatialColors.gray,
|
|
75
|
+
},
|
|
76
|
+
danger: {
|
|
77
|
+
text: '#d32f2f',
|
|
78
|
+
hoverText: spatialColors.white,
|
|
79
|
+
hoverBg: '#d32f2f',
|
|
80
|
+
hoverBorder: '#d32f2f',
|
|
81
|
+
hoverCounterBg: 'rgba(255, 255, 255, 0.2)',
|
|
82
|
+
selectedText: spatialColors.white,
|
|
83
|
+
selectedBg: '#b71c1c',
|
|
84
|
+
selectedBorder: '#b71c1c',
|
|
85
|
+
disabledText: 'rgba(211, 47, 47, 0.5)',
|
|
86
|
+
disabledBg: spatialColors.indigoTint,
|
|
87
|
+
disabledCounterBg: 'rgba(211, 47, 47, 0.05)',
|
|
88
|
+
counterBg: 'rgba(211, 47, 47, 0.1)',
|
|
89
|
+
counterFg: '#d32f2f',
|
|
90
|
+
hoverCounterFg: spatialColors.white,
|
|
91
|
+
disabledCounterFg: 'rgba(211, 47, 47, 0.5)',
|
|
92
|
+
icon: '#d32f2f',
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
/* ── Dark-mode colour definitions ────────────────────────────────────── */
|
|
97
|
+
const spatialDark = {
|
|
98
|
+
canvas: {
|
|
99
|
+
default: spatialColors.black,
|
|
100
|
+
subtle: '#111827',
|
|
101
|
+
},
|
|
102
|
+
fg: {
|
|
103
|
+
default: '#E0E7FF',
|
|
104
|
+
muted: '#94A3B8',
|
|
105
|
+
onEmphasis: spatialColors.white,
|
|
106
|
+
},
|
|
107
|
+
accent: {
|
|
108
|
+
fg: spatialColors.indigoAccent,
|
|
109
|
+
emphasis: spatialColors.indigoBright,
|
|
110
|
+
muted: spatialColors.indigoBrand,
|
|
111
|
+
subtle: '#1E1B4B',
|
|
112
|
+
},
|
|
113
|
+
success: {
|
|
114
|
+
fg: spatialColors.indigoAccent,
|
|
115
|
+
emphasis: spatialColors.indigoBright,
|
|
116
|
+
muted: spatialColors.indigoBrand,
|
|
117
|
+
subtle: '#1E1B4B',
|
|
118
|
+
},
|
|
119
|
+
btn: {
|
|
120
|
+
text: '#E0E7FF',
|
|
121
|
+
bg: '#1E293B',
|
|
122
|
+
border: 'rgba(199, 210, 254, 0.15)',
|
|
123
|
+
hoverBg: '#334155',
|
|
124
|
+
hoverBorder: '#94A3B8',
|
|
125
|
+
activeBg: '#1E293B',
|
|
126
|
+
activeBorder: '#64748B',
|
|
127
|
+
selectedBg: '#0F172A',
|
|
128
|
+
counterBg: '#334155',
|
|
129
|
+
primary: {
|
|
130
|
+
text: spatialColors.white,
|
|
131
|
+
bg: spatialColors.indigoAccent,
|
|
132
|
+
border: 'rgba(199, 210, 254, 0.15)',
|
|
133
|
+
hoverBg: spatialColors.indigoBright,
|
|
134
|
+
hoverBorder: 'rgba(199, 210, 254, 0.15)',
|
|
135
|
+
selectedBg: spatialColors.indigoBright,
|
|
136
|
+
disabledText: 'rgba(255, 255, 255, 0.5)',
|
|
137
|
+
disabledBg: 'rgba(79, 70, 229, 0.35)',
|
|
138
|
+
disabledBorder: 'rgba(79, 70, 229, 0.2)',
|
|
139
|
+
icon: spatialColors.white,
|
|
140
|
+
counterBg: 'rgba(0, 0, 0, 0.2)',
|
|
141
|
+
},
|
|
142
|
+
outline: {
|
|
143
|
+
text: spatialColors.indigoAccent,
|
|
144
|
+
hoverText: spatialColors.white,
|
|
145
|
+
hoverBg: spatialColors.indigoAccent,
|
|
146
|
+
hoverBorder: spatialColors.indigoAccent,
|
|
147
|
+
hoverCounterBg: 'rgba(255, 255, 255, 0.2)',
|
|
148
|
+
selectedText: spatialColors.white,
|
|
149
|
+
selectedBg: spatialColors.indigoBright,
|
|
150
|
+
selectedBorder: spatialColors.indigoBright,
|
|
151
|
+
disabledText: 'rgba(99, 102, 241, 0.5)',
|
|
152
|
+
disabledBg: 'rgba(99, 102, 241, 0.1)',
|
|
153
|
+
disabledCounterBg: 'rgba(99, 102, 241, 0.05)',
|
|
154
|
+
counterBg: 'rgba(99, 102, 241, 0.1)',
|
|
155
|
+
counterFg: spatialColors.indigoAccent,
|
|
156
|
+
hoverCounterFg: spatialColors.white,
|
|
157
|
+
disabledCounterFg: 'rgba(99, 102, 241, 0.5)',
|
|
158
|
+
},
|
|
159
|
+
danger: {
|
|
160
|
+
text: '#f85149',
|
|
161
|
+
hoverText: spatialColors.white,
|
|
162
|
+
hoverBg: '#da3633',
|
|
163
|
+
hoverBorder: '#f85149',
|
|
164
|
+
hoverCounterBg: 'rgba(255, 255, 255, 0.2)',
|
|
165
|
+
selectedText: spatialColors.white,
|
|
166
|
+
selectedBg: '#b62324',
|
|
167
|
+
selectedBorder: '#ff7b72',
|
|
168
|
+
disabledText: 'rgba(248, 81, 73, 0.5)',
|
|
169
|
+
disabledBg: 'rgba(248, 81, 73, 0.1)',
|
|
170
|
+
disabledCounterBg: 'rgba(248, 81, 73, 0.05)',
|
|
171
|
+
counterBg: 'rgba(248, 81, 73, 0.1)',
|
|
172
|
+
counterFg: '#f85149',
|
|
173
|
+
hoverCounterFg: spatialColors.white,
|
|
174
|
+
disabledCounterFg: 'rgba(248, 81, 73, 0.5)',
|
|
175
|
+
icon: '#f85149',
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
/* ── Exports ─────────────────────────────────────────────────────────── */
|
|
180
|
+
/**
|
|
181
|
+
* The Primer theme object.
|
|
182
|
+
*
|
|
183
|
+
* Since theming is now done entirely via CSS custom properties
|
|
184
|
+
* (see `spatialThemeStyles`), this is just the unmodified
|
|
185
|
+
* default Primer theme kept for backward compatibility.
|
|
186
|
+
*/
|
|
187
|
+
export const spatialTheme = primerTheme;
|
|
188
|
+
/** Comprehensive Primer CSS-variable overrides for light & dark mode. */
|
|
189
|
+
export const spatialThemeStyles = buildThemeStyles(spatialLight, spatialDark);
|
|
190
|
+
export default spatialTheme;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './spatialBrandTheme';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type CSSProperties } from 'react';
|
|
2
|
+
export declare const spatialBrandLight: CSSProperties;
|
|
3
|
+
export declare const spatialBrandDark: CSSProperties;
|
|
4
|
+
/**
|
|
5
|
+
* Spatial Brand Theme — combined light + dark overrides.
|
|
6
|
+
*
|
|
7
|
+
* Pass to `DatalayerBrandThemeProvider`'s `brandTheme` prop.
|
|
8
|
+
*/
|
|
9
|
+
export declare const spatialBrandTheme: {
|
|
10
|
+
light: CSSProperties;
|
|
11
|
+
dark: CSSProperties;
|
|
12
|
+
};
|
|
13
|
+
export type BrandTheme = {
|
|
14
|
+
light: CSSProperties;
|
|
15
|
+
dark: CSSProperties;
|
|
16
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Spatial Brand Theme — Cosmic & Space-Inspired
|
|
7
|
+
*
|
|
8
|
+
* Overrides Primer Brand (`@primer/react-brand`) CSS custom properties
|
|
9
|
+
* to produce an indigo / deep-blue aesthetic. The tokens listed here
|
|
10
|
+
* mirror the `--brand-color-*` and `--brand-button-*` variables defined
|
|
11
|
+
* in `@primer/react-brand/lib/css/main.css`.
|
|
12
|
+
*
|
|
13
|
+
* Primer Brand components resolve their colours exclusively through
|
|
14
|
+
* CSS custom properties scoped under `[data-color-mode]` selectors.
|
|
15
|
+
* By providing higher-specificity inline style overrides through the
|
|
16
|
+
* `DatalayerBrandThemeProvider`, we swap the entire palette without
|
|
17
|
+
* touching the Brand stylesheet itself — the same technique the
|
|
18
|
+
* VS Code extension uses to re-skin Primer for its webviews.
|
|
19
|
+
*/
|
|
20
|
+
import { spatialColors } from '../colors';
|
|
21
|
+
/* ── Light mode ─────────────────────────────────────────────────────── */
|
|
22
|
+
export const spatialBrandLight = {
|
|
23
|
+
// Canvas
|
|
24
|
+
'--brand-color-canvas-default': spatialColors.white,
|
|
25
|
+
'--brand-color-canvas-overlay': spatialColors.white,
|
|
26
|
+
'--brand-color-canvas-inset': spatialColors.indigoTint,
|
|
27
|
+
'--brand-color-canvas-subtle': spatialColors.indigoTint,
|
|
28
|
+
// Text
|
|
29
|
+
'--brand-color-text-default': '#1E1E3F',
|
|
30
|
+
'--brand-color-text-muted': spatialColors.gray,
|
|
31
|
+
'--brand-color-text-subtle': '#A0AEC0',
|
|
32
|
+
'--brand-color-text-onEmphasis': spatialColors.white,
|
|
33
|
+
// Accent
|
|
34
|
+
'--brand-color-accent-primary': spatialColors.indigoBrand,
|
|
35
|
+
'--brand-color-accent-secondary': spatialColors.indigoAccent,
|
|
36
|
+
// Borders
|
|
37
|
+
'--brand-color-border-default': '#C7D2FE',
|
|
38
|
+
'--brand-color-border-muted': '#DDD6FE',
|
|
39
|
+
'--brand-color-border-subtle': spatialColors.indigoTint,
|
|
40
|
+
// Focus
|
|
41
|
+
'--brand-color-focus': spatialColors.indigoBrand,
|
|
42
|
+
// Neutral
|
|
43
|
+
'--brand-color-neutral-emphasisPlus': '#1E1E3F',
|
|
44
|
+
'--brand-color-neutral-emphasis': spatialColors.gray,
|
|
45
|
+
'--brand-color-neutral-muted': 'rgba(99, 102, 241, 0.20)',
|
|
46
|
+
'--brand-color-neutral-subtle': 'rgba(99, 102, 241, 0.08)',
|
|
47
|
+
// Success / Error (keep semantic)
|
|
48
|
+
'--brand-color-success-fg': '#1a7f37',
|
|
49
|
+
'--brand-color-success-emphasis': '#2da44e',
|
|
50
|
+
'--brand-color-success-muted': 'rgba(75, 195, 107, 0.6)',
|
|
51
|
+
'--brand-color-success-subtle': '#dafbe1',
|
|
52
|
+
'--brand-color-error-fg': '#d32f2f',
|
|
53
|
+
'--brand-color-error-emphasis': '#d32f2f',
|
|
54
|
+
'--brand-color-error-muted': 'rgba(255, 135, 133, 0.6)',
|
|
55
|
+
'--brand-color-error-subtle': '#ffdcd7',
|
|
56
|
+
// Buttons — primary
|
|
57
|
+
'--brand-button-primary-bgColor-rest': spatialColors.indigoText,
|
|
58
|
+
'--brand-button-primary-bgColor-hover': spatialColors.indigoHover,
|
|
59
|
+
'--brand-button-primary-bgColor-active': spatialColors.indigoHover,
|
|
60
|
+
'--brand-button-primary-bgColor-disabled': '#B4B0D8',
|
|
61
|
+
'--brand-button-primary-borderColor-rest': spatialColors.indigoText,
|
|
62
|
+
'--brand-button-primary-borderColor-hover': spatialColors.indigoHover,
|
|
63
|
+
'--brand-button-primary-borderColor-active': spatialColors.indigoHover,
|
|
64
|
+
'--brand-button-primary-borderColor-disabled': '#B4B0D8',
|
|
65
|
+
'--brand-button-primary-fgColor-rest': spatialColors.white,
|
|
66
|
+
'--brand-button-primary-fgColor-disabled': 'rgba(255, 255, 255, 0.5)',
|
|
67
|
+
// Buttons — accent
|
|
68
|
+
'--brand-button-accent-bgColor-rest': spatialColors.indigoBrand,
|
|
69
|
+
'--brand-button-accent-bgColor-hover': spatialColors.indigoAccent,
|
|
70
|
+
'--brand-button-accent-bgColor-active': spatialColors.indigoBrand,
|
|
71
|
+
'--brand-button-accent-bgColor-disabled': '#B4B0D8',
|
|
72
|
+
'--brand-button-accent-fgColor-rest': spatialColors.white,
|
|
73
|
+
'--brand-button-accent-fgColor-disabled': 'rgba(255, 255, 255, 0.5)',
|
|
74
|
+
// Buttons — secondary
|
|
75
|
+
'--brand-button-secondary-bgColor-rest': 'transparent',
|
|
76
|
+
'--brand-button-secondary-borderColor-rest': 'rgba(79, 70, 229, 0.25)',
|
|
77
|
+
'--brand-button-secondary-borderColor-hover': 'rgba(79, 70, 229, 0.5)',
|
|
78
|
+
'--brand-button-secondary-borderColor-active': 'rgba(79, 70, 229, 0.5)',
|
|
79
|
+
'--brand-button-secondary-fgColor-rest': spatialColors.indigoText,
|
|
80
|
+
'--brand-button-secondary-fgColor-disabled': '#B4B0D8',
|
|
81
|
+
// Applied styles
|
|
82
|
+
backgroundColor: spatialColors.white,
|
|
83
|
+
color: '#1E1E3F',
|
|
84
|
+
};
|
|
85
|
+
/* ── Dark mode ──────────────────────────────────────────────────────── */
|
|
86
|
+
export const spatialBrandDark = {
|
|
87
|
+
// Canvas
|
|
88
|
+
'--brand-color-canvas-default': spatialColors.black,
|
|
89
|
+
'--brand-color-canvas-overlay': '#111827',
|
|
90
|
+
'--brand-color-canvas-inset': spatialColors.black,
|
|
91
|
+
'--brand-color-canvas-subtle': '#111827',
|
|
92
|
+
// Text
|
|
93
|
+
'--brand-color-text-default': '#E0E7FF',
|
|
94
|
+
'--brand-color-text-muted': '#94A3B8',
|
|
95
|
+
'--brand-color-text-subtle': '#64748B',
|
|
96
|
+
'--brand-color-text-onEmphasis': spatialColors.white,
|
|
97
|
+
// Accent
|
|
98
|
+
'--brand-color-accent-primary': spatialColors.indigoAccent,
|
|
99
|
+
'--brand-color-accent-secondary': spatialColors.indigoBright,
|
|
100
|
+
// Borders
|
|
101
|
+
'--brand-color-border-default': 'rgba(199, 210, 254, 0.15)',
|
|
102
|
+
'--brand-color-border-muted': 'rgba(199, 210, 254, 0.10)',
|
|
103
|
+
'--brand-color-border-subtle': 'rgba(199, 210, 254, 0.06)',
|
|
104
|
+
// Focus
|
|
105
|
+
'--brand-color-focus': spatialColors.indigoAccent,
|
|
106
|
+
// Neutral
|
|
107
|
+
'--brand-color-neutral-emphasisPlus': '#94A3B8',
|
|
108
|
+
'--brand-color-neutral-emphasis': '#64748B',
|
|
109
|
+
'--brand-color-neutral-muted': 'rgba(99, 102, 241, 0.25)',
|
|
110
|
+
'--brand-color-neutral-subtle': 'rgba(99, 102, 241, 0.12)',
|
|
111
|
+
// Success / Error
|
|
112
|
+
'--brand-color-success-fg': '#3fb950',
|
|
113
|
+
'--brand-color-success-emphasis': '#238636',
|
|
114
|
+
'--brand-color-success-muted': 'rgba(46, 158, 66, 0.6)',
|
|
115
|
+
'--brand-color-success-subtle': 'rgba(46, 158, 66, 0.85)',
|
|
116
|
+
'--brand-color-error-fg': '#f85149',
|
|
117
|
+
'--brand-color-error-emphasis': '#da3633',
|
|
118
|
+
'--brand-color-error-muted': 'rgba(248, 82, 73, 0.6)',
|
|
119
|
+
'--brand-color-error-subtle': 'rgba(248, 82, 73, 0.85)',
|
|
120
|
+
// Buttons — primary
|
|
121
|
+
'--brand-button-primary-bgColor-rest': spatialColors.indigoAccent,
|
|
122
|
+
'--brand-button-primary-bgColor-hover': spatialColors.indigoBright,
|
|
123
|
+
'--brand-button-primary-bgColor-active': spatialColors.indigoBright,
|
|
124
|
+
'--brand-button-primary-bgColor-disabled': 'rgba(79, 70, 229, 0.35)',
|
|
125
|
+
'--brand-button-primary-borderColor-rest': 'rgba(199, 210, 254, 0.15)',
|
|
126
|
+
'--brand-button-primary-borderColor-hover': 'rgba(199, 210, 254, 0.15)',
|
|
127
|
+
'--brand-button-primary-borderColor-active': 'rgba(199, 210, 254, 0.15)',
|
|
128
|
+
'--brand-button-primary-borderColor-disabled': 'rgba(79, 70, 229, 0.2)',
|
|
129
|
+
'--brand-button-primary-fgColor-rest': spatialColors.white,
|
|
130
|
+
'--brand-button-primary-fgColor-disabled': 'rgba(255, 255, 255, 0.5)',
|
|
131
|
+
// Buttons — accent
|
|
132
|
+
'--brand-button-accent-bgColor-rest': spatialColors.indigoBrand,
|
|
133
|
+
'--brand-button-accent-bgColor-hover': spatialColors.indigoAccent,
|
|
134
|
+
'--brand-button-accent-bgColor-active': spatialColors.indigoBrand,
|
|
135
|
+
'--brand-button-accent-bgColor-disabled': 'rgba(79, 70, 229, 0.35)',
|
|
136
|
+
'--brand-button-accent-fgColor-rest': spatialColors.white,
|
|
137
|
+
'--brand-button-accent-fgColor-disabled': 'rgba(255, 255, 255, 0.5)',
|
|
138
|
+
// Buttons — secondary
|
|
139
|
+
'--brand-button-secondary-bgColor-rest': 'transparent',
|
|
140
|
+
'--brand-button-secondary-borderColor-rest': 'rgba(199, 210, 254, 0.15)',
|
|
141
|
+
'--brand-button-secondary-borderColor-hover': 'rgba(199, 210, 254, 0.3)',
|
|
142
|
+
'--brand-button-secondary-borderColor-active': 'rgba(199, 210, 254, 0.3)',
|
|
143
|
+
'--brand-button-secondary-fgColor-rest': '#E0E7FF',
|
|
144
|
+
'--brand-button-secondary-fgColor-disabled': 'rgba(99, 102, 241, 0.5)',
|
|
145
|
+
// Applied styles
|
|
146
|
+
backgroundColor: spatialColors.black,
|
|
147
|
+
color: '#E0E7FF',
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Spatial Brand Theme — combined light + dark overrides.
|
|
151
|
+
*
|
|
152
|
+
* Pass to `DatalayerBrandThemeProvider`'s `brandTheme` prop.
|
|
153
|
+
*/
|
|
154
|
+
export const spatialBrandTheme = {
|
|
155
|
+
light: spatialBrandLight,
|
|
156
|
+
dark: spatialBrandDark,
|
|
157
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type ResolvedColorMode = 'light' | 'dark';
|
|
2
|
+
/**
|
|
3
|
+
* React hook that tracks the operating system's preferred color scheme.
|
|
4
|
+
*
|
|
5
|
+
* Listens to `prefers-color-scheme` media query changes and returns
|
|
6
|
+
* either `'light'` or `'dark'`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useSystemColorMode(): ResolvedColorMode;
|
|
9
|
+
export default useSystemColorMode;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
|
+
/**
|
|
7
|
+
* React hook that tracks the operating system's preferred color scheme.
|
|
8
|
+
*
|
|
9
|
+
* Listens to `prefers-color-scheme` media query changes and returns
|
|
10
|
+
* either `'light'` or `'dark'`.
|
|
11
|
+
*/
|
|
12
|
+
export function useSystemColorMode() {
|
|
13
|
+
const getMode = () => typeof window !== 'undefined' &&
|
|
14
|
+
window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
15
|
+
? 'dark'
|
|
16
|
+
: 'light';
|
|
17
|
+
const [mode, setMode] = useState(getMode);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const media = window.matchMedia('(prefers-color-scheme: dark)');
|
|
20
|
+
const listener = (e) => setMode(e.matches ? 'dark' : 'light');
|
|
21
|
+
media.addEventListener('change', listener);
|
|
22
|
+
return () => media.removeEventListener('change', listener);
|
|
23
|
+
}, []);
|
|
24
|
+
return mode;
|
|
25
|
+
}
|
|
26
|
+
export default useSystemColorMode;
|