@datalayer/primer-addons 1.0.10 → 1.0.12
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/appearance/AppearanceControls.d.ts +10 -0
- package/lib/components/appearance/AppearanceControls.js +42 -0
- package/lib/components/appearance/AppearanceControlsWithStore.d.ts +8 -0
- package/lib/components/appearance/AppearanceControlsWithStore.js +21 -0
- package/lib/components/appearance/index.d.ts +2 -0
- package/lib/components/appearance/index.js +6 -0
- package/lib/components/index.d.ts +4 -0
- package/lib/components/index.js +4 -0
- package/lib/components/logo/DatalayerLogo.d.ts +18 -0
- package/lib/components/logo/DatalayerLogo.js +63 -0
- package/lib/components/logo/DatalayerLogoText.d.ts +22 -0
- package/lib/components/logo/DatalayerLogoText.js +29 -0
- package/lib/components/logo/DatalayerText.d.ts +16 -0
- package/lib/components/logo/DatalayerText.js +16 -0
- package/lib/components/logo/index.d.ts +3 -0
- package/lib/components/logo/index.js +3 -0
- package/lib/index.js +0 -1
- package/lib/theme/DatalayerThemeProvider.js +83 -6
- package/lib/theme/Palette.d.ts +8 -4
- package/lib/theme/Palette.js +13 -6
- package/lib/theme/ThemedProvider.d.ts +25 -0
- package/lib/theme/ThemedProvider.js +14 -0
- package/lib/theme/colors/datalayerColors.d.ts +14 -0
- package/lib/theme/colors/datalayerColors.js +17 -0
- package/lib/theme/colors/index.d.ts +1 -0
- package/lib/theme/colors/index.js +1 -0
- package/lib/theme/colors/indicatorColors.d.ts +50 -0
- package/lib/theme/colors/indicatorColors.js +68 -0
- package/lib/theme/colors/lovelyColors.d.ts +14 -0
- package/lib/theme/colors/lovelyColors.js +17 -0
- package/lib/theme/colors/matrixColors.d.ts +14 -0
- package/lib/theme/colors/matrixColors.js +17 -0
- package/lib/theme/colors/spatialColors.d.ts +14 -0
- package/lib/theme/colors/spatialColors.js +17 -0
- package/lib/theme/index.d.ts +2 -0
- package/lib/theme/index.js +2 -0
- package/lib/theme/themeRegistry.d.ts +75 -0
- package/lib/theme/themeRegistry.js +235 -0
- package/lib/theme/themes/createThemeCSSVars.d.ts +14 -1
- package/lib/theme/themes/createThemeCSSVars.js +70 -9
- package/lib/theme/themes/matrixTheme.d.ts +1 -4
- package/lib/theme/themes/matrixTheme.js +3 -7
- package/lib/theme/useThemeStore.d.ts +50 -0
- package/lib/theme/useThemeStore.js +65 -0
- package/lib/utils/Portals.d.ts +19 -0
- package/lib/utils/Portals.js +111 -9
- package/package.json +3 -2
- /package/lib/{_utils/story-helpers.d.ts → story-helpers.d.ts} +0 -0
- /package/lib/{_utils/story-helpers.js → story-helpers.js} +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 Datalayer, Inc.
|
|
3
|
+
* Distributed under the terms of the Modified BSD License.
|
|
4
|
+
*/
|
|
5
|
+
/* ── Per-theme palettes ────────────────────────────────── */
|
|
6
|
+
const datalayer = {
|
|
7
|
+
neutral: '#656D76',
|
|
8
|
+
muted: '#8b949e',
|
|
9
|
+
pending: '#d29922',
|
|
10
|
+
warning: '#d29922',
|
|
11
|
+
danger: '#d1242f',
|
|
12
|
+
success: '#16A085',
|
|
13
|
+
info: '#0969da',
|
|
14
|
+
reservation: '#656D76',
|
|
15
|
+
credits: '#16A085',
|
|
16
|
+
inviteJoined: '#0969da',
|
|
17
|
+
invitePending: '#cfd3d7',
|
|
18
|
+
};
|
|
19
|
+
const spatial = {
|
|
20
|
+
neutral: '#8892B0',
|
|
21
|
+
muted: '#6B7394',
|
|
22
|
+
pending: '#E2B340',
|
|
23
|
+
warning: '#E2B340',
|
|
24
|
+
danger: '#FF5252',
|
|
25
|
+
success: '#4F46E5',
|
|
26
|
+
info: '#448AFF',
|
|
27
|
+
reservation: '#8892B0',
|
|
28
|
+
credits: '#4F46E5',
|
|
29
|
+
inviteJoined: '#448AFF',
|
|
30
|
+
invitePending: '#6B7394',
|
|
31
|
+
};
|
|
32
|
+
const lovely = {
|
|
33
|
+
neutral: '#9D7A8F',
|
|
34
|
+
muted: '#C9A2B8',
|
|
35
|
+
pending: '#FFD740',
|
|
36
|
+
warning: '#FFD740',
|
|
37
|
+
danger: '#FF1744',
|
|
38
|
+
success: '#DB2777',
|
|
39
|
+
info: '#536DFE',
|
|
40
|
+
reservation: '#9D7A8F',
|
|
41
|
+
credits: '#DB2777',
|
|
42
|
+
inviteJoined: '#536DFE',
|
|
43
|
+
invitePending: '#C9A2B8',
|
|
44
|
+
};
|
|
45
|
+
const matrix = {
|
|
46
|
+
neutral: '#5A6E3A',
|
|
47
|
+
muted: '#7A9A50',
|
|
48
|
+
pending: '#FFD600',
|
|
49
|
+
warning: '#FFD600',
|
|
50
|
+
danger: '#FF3D00',
|
|
51
|
+
success: '#00C853',
|
|
52
|
+
info: '#00E676',
|
|
53
|
+
reservation: '#5A6E3A',
|
|
54
|
+
credits: '#00C853',
|
|
55
|
+
inviteJoined: '#00E676',
|
|
56
|
+
invitePending: '#7A9A50',
|
|
57
|
+
};
|
|
58
|
+
/* ── Public map ────────────────────────────────────────── */
|
|
59
|
+
export const indicatorColors = {
|
|
60
|
+
datalayer,
|
|
61
|
+
spatial,
|
|
62
|
+
lovely,
|
|
63
|
+
matrix,
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Convenience: default indicator palette (Datalayer theme).
|
|
67
|
+
*/
|
|
68
|
+
export const defaultIndicatorColors = datalayer;
|
|
@@ -12,4 +12,18 @@ export declare const lovelyColors: {
|
|
|
12
12
|
roseTint: string;
|
|
13
13
|
roseBright: string;
|
|
14
14
|
roseHover: string;
|
|
15
|
+
brightGlow: string;
|
|
16
|
+
brightPop: string;
|
|
17
|
+
brightSpark: string;
|
|
18
|
+
brightBlaze: string;
|
|
19
|
+
brightSurge: string;
|
|
20
|
+
brightFlame: string;
|
|
21
|
+
brightGold: string;
|
|
22
|
+
brightLightGlow: string;
|
|
23
|
+
brightLightPop: string;
|
|
24
|
+
brightLightSpark: string;
|
|
25
|
+
brightLightBlaze: string;
|
|
26
|
+
brightLightSurge: string;
|
|
27
|
+
brightLightFlame: string;
|
|
28
|
+
brightLightGold: string;
|
|
15
29
|
};
|
|
@@ -18,4 +18,21 @@ export const lovelyColors = {
|
|
|
18
18
|
roseTint: '#FDF2F8', // Soft background for callouts
|
|
19
19
|
roseBright: '#F472B6', // Highlights & glow on dark
|
|
20
20
|
roseHover: '#831843', // Primary button hover
|
|
21
|
+
// Bright / vivid colours for SVG illustrations (OpenAI-blog style)
|
|
22
|
+
brightGlow: '#FF4081', // Hot pink — primary glow
|
|
23
|
+
brightPop: '#FF6E40', // Vivid coral — contrasting accent
|
|
24
|
+
brightSpark: '#EA80FC', // Electric fuchsia — sparkle / tertiary
|
|
25
|
+
brightBlaze: '#FF1744', // Vivid crimson — warm accent
|
|
26
|
+
brightSurge: '#536DFE', // Indigo blue — cool accent
|
|
27
|
+
// Warm vivid colours — yellow & orange accents for SVG illustrations
|
|
28
|
+
brightFlame: '#FF6E40', // Coral orange — warm blush accent
|
|
29
|
+
brightGold: '#FFD740', // Amber gold — golden warmth
|
|
30
|
+
// Vivid brights for light backgrounds — punchy, saturated, OpenAI-blog vibrancy
|
|
31
|
+
brightLightGlow: '#FF4081', // Hot pink
|
|
32
|
+
brightLightPop: '#FF6E40', // Vivid coral
|
|
33
|
+
brightLightSpark: '#EA80FC', // Electric fuchsia
|
|
34
|
+
brightLightBlaze: '#FF1744', // Vivid crimson
|
|
35
|
+
brightLightSurge: '#536DFE', // Vivid indigo
|
|
36
|
+
brightLightFlame: '#FF6E40', // Vivid coral orange
|
|
37
|
+
brightLightGold: '#FFD740', // Vivid amber gold
|
|
21
38
|
};
|
|
@@ -17,4 +17,18 @@ export declare const matrixColors: {
|
|
|
17
17
|
greenGlow: string;
|
|
18
18
|
greenHover: string;
|
|
19
19
|
greenTerminal: string;
|
|
20
|
+
brightGlow: string;
|
|
21
|
+
brightPop: string;
|
|
22
|
+
brightSpark: string;
|
|
23
|
+
brightBlaze: string;
|
|
24
|
+
brightSurge: string;
|
|
25
|
+
brightFlame: string;
|
|
26
|
+
brightGold: string;
|
|
27
|
+
brightLightGlow: string;
|
|
28
|
+
brightLightPop: string;
|
|
29
|
+
brightLightSpark: string;
|
|
30
|
+
brightLightBlaze: string;
|
|
31
|
+
brightLightSurge: string;
|
|
32
|
+
brightLightFlame: string;
|
|
33
|
+
brightLightGold: string;
|
|
20
34
|
};
|
|
@@ -23,4 +23,21 @@ export const matrixColors = {
|
|
|
23
23
|
greenGlow: '#39FF14', // Neon phosphor glow — brightest accent on dark
|
|
24
24
|
greenHover: '#0E6655', // Datalayer hover — primary button hover
|
|
25
25
|
greenTerminal: '#003B00', // Deep terminal — dark mode subtle/canvas
|
|
26
|
+
// Bright / vivid colours for SVG illustrations (OpenAI-blog style)
|
|
27
|
+
brightGlow: '#39FF14', // Neon green — primary glow (re-stated for palette API)
|
|
28
|
+
brightPop: '#00FF88', // Phosphor cyan — contrasting accent
|
|
29
|
+
brightSpark: '#CCFF00', // Acid lime — sparkle / tertiary
|
|
30
|
+
brightBlaze: '#FF0040', // Matrix red pill — warm accent
|
|
31
|
+
brightSurge: '#00E5FF', // Electric blue — cool accent
|
|
32
|
+
// Warm vivid colours — yellow & orange accents for SVG illustrations
|
|
33
|
+
brightFlame: '#FF6D00', // Electric orange — glitch warm accent
|
|
34
|
+
brightGold: '#FFEA00', // Glitch yellow — phosphor highlight
|
|
35
|
+
// Vivid brights for light backgrounds — punchy, saturated, OpenAI-blog vibrancy
|
|
36
|
+
brightLightGlow: '#00E676', // Vivid green
|
|
37
|
+
brightLightPop: '#1DE9B6', // Vivid teal-mint
|
|
38
|
+
brightLightSpark: '#AEEA00', // Vivid lime
|
|
39
|
+
brightLightBlaze: '#FF1744', // Vivid red
|
|
40
|
+
brightLightSurge: '#00B0FF', // Vivid sky blue
|
|
41
|
+
brightLightFlame: '#FF6D00', // Vivid orange
|
|
42
|
+
brightLightGold: '#FFAB00', // Vivid amber
|
|
26
43
|
};
|
|
@@ -12,4 +12,18 @@ export declare const spatialColors: {
|
|
|
12
12
|
indigoTint: string;
|
|
13
13
|
indigoBright: string;
|
|
14
14
|
indigoHover: string;
|
|
15
|
+
brightGlow: string;
|
|
16
|
+
brightPop: string;
|
|
17
|
+
brightSpark: string;
|
|
18
|
+
brightBlaze: string;
|
|
19
|
+
brightSurge: string;
|
|
20
|
+
brightFlame: string;
|
|
21
|
+
brightGold: string;
|
|
22
|
+
brightLightGlow: string;
|
|
23
|
+
brightLightPop: string;
|
|
24
|
+
brightLightSpark: string;
|
|
25
|
+
brightLightBlaze: string;
|
|
26
|
+
brightLightSurge: string;
|
|
27
|
+
brightLightFlame: string;
|
|
28
|
+
brightLightGold: string;
|
|
15
29
|
};
|
|
@@ -18,4 +18,21 @@ export const spatialColors = {
|
|
|
18
18
|
indigoTint: '#EEF2FF', // Soft background for callouts
|
|
19
19
|
indigoBright: '#818CF8', // Highlights & glow on dark
|
|
20
20
|
indigoHover: '#312E81', // Primary button hover
|
|
21
|
+
// Bright / vivid colours for SVG illustrations (OpenAI-blog style)
|
|
22
|
+
brightGlow: '#7C4DFF', // Electric violet — primary glow
|
|
23
|
+
brightPop: '#448AFF', // Neon blue — contrasting accent
|
|
24
|
+
brightSpark: '#E040FB', // Vivid magenta — sparkle / tertiary
|
|
25
|
+
brightBlaze: '#FF5252', // Neon red — warm accent
|
|
26
|
+
brightSurge: '#00B0FF', // Deep sky blue — cool accent
|
|
27
|
+
// Warm vivid colours — yellow & orange accents for SVG illustrations
|
|
28
|
+
brightFlame: '#FF9100', // Amber orange — warm cosmic accent
|
|
29
|
+
brightGold: '#FFEA00', // Electric yellow — star highlight
|
|
30
|
+
// Vivid brights for light backgrounds — punchy, saturated, OpenAI-blog vibrancy
|
|
31
|
+
brightLightGlow: '#7C4DFF', // Electric violet
|
|
32
|
+
brightLightPop: '#448AFF', // Neon blue
|
|
33
|
+
brightLightSpark: '#D500F9', // Vivid purple
|
|
34
|
+
brightLightBlaze: '#FF5252', // Neon red
|
|
35
|
+
brightLightSurge: '#00B0FF', // Vivid sky blue
|
|
36
|
+
brightLightFlame: '#FF9100', // Vivid amber orange
|
|
37
|
+
brightLightGold: '#FFC400', // Vivid gold
|
|
21
38
|
};
|
package/lib/theme/index.d.ts
CHANGED
package/lib/theme/index.js
CHANGED
|
@@ -2,6 +2,37 @@ import { type CSSProperties } from 'react';
|
|
|
2
2
|
import { type ColorMode } from './DatalayerBrandThemeProvider';
|
|
3
3
|
/** Available theme variants. */
|
|
4
4
|
export type ThemeVariant = 'datalayer' | 'spatial' | 'lovely' | 'matrix';
|
|
5
|
+
/** A pair of colours for a two-stop gradient. */
|
|
6
|
+
export interface GradientPair {
|
|
7
|
+
/** Start colour (brighter / brand). */
|
|
8
|
+
from: string;
|
|
9
|
+
/** End colour (deeper / hover). */
|
|
10
|
+
to: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Vivid colour triplet for SVG illustrations.
|
|
14
|
+
*
|
|
15
|
+
* Inspired by OpenAI's blog — ultra-saturated, luminous hues designed
|
|
16
|
+
* to glow and pop against both light and dark backgrounds.
|
|
17
|
+
*/
|
|
18
|
+
export interface BrightPalette {
|
|
19
|
+
/** Primary vivid accent — the "star" glow colour. */
|
|
20
|
+
glow: string;
|
|
21
|
+
/** Optimal text colour for content rendered on a `glow` background. */
|
|
22
|
+
onGlow: string;
|
|
23
|
+
/** Contrasting vivid colour — analogous/complement. */
|
|
24
|
+
pop: string;
|
|
25
|
+
/** Third vivid colour — sparkle / small highlights. */
|
|
26
|
+
spark: string;
|
|
27
|
+
/** Vivid red / warm accent — energy, urgency, warmth. */
|
|
28
|
+
blaze: string;
|
|
29
|
+
/** Vivid blue / cool accent — depth, trust, electricity. */
|
|
30
|
+
surge: string;
|
|
31
|
+
/** Vivid orange — warm energy, fire, dynamism. */
|
|
32
|
+
flame: string;
|
|
33
|
+
/** Vivid yellow / gold — highlights, attention, optimism. */
|
|
34
|
+
gold: string;
|
|
35
|
+
}
|
|
5
36
|
/**
|
|
6
37
|
* Complete configuration for a theme, including the Primer theme object,
|
|
7
38
|
* display metadata, and CSS custom property overrides per color mode.
|
|
@@ -22,9 +53,53 @@ export interface ThemeConfig {
|
|
|
22
53
|
light: CSSProperties;
|
|
23
54
|
dark: CSSProperties;
|
|
24
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* Per-mode gradient pair for card backgrounds, banners, and other
|
|
58
|
+
* decorative surfaces that need a themed two-colour gradient.
|
|
59
|
+
*/
|
|
60
|
+
cardGradient: {
|
|
61
|
+
light: GradientPair;
|
|
62
|
+
dark: GradientPair;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Vivid colour triplet for SVG illustrations — ultra-saturated,
|
|
66
|
+
* luminous hues that glow and pop on dark backgrounds (OpenAI-blog style).
|
|
67
|
+
*/
|
|
68
|
+
brightPalette: BrightPalette;
|
|
69
|
+
/**
|
|
70
|
+
* Deeper / richer bright palette for light backgrounds.
|
|
71
|
+
* Same hue families as `brightPalette` but with higher contrast on
|
|
72
|
+
* light surfaces so illustrations don't appear faded.
|
|
73
|
+
*/
|
|
74
|
+
brightPaletteLight: BrightPalette;
|
|
25
75
|
}
|
|
26
76
|
export declare const themeConfigs: Record<ThemeVariant, ThemeConfig>;
|
|
27
77
|
/** All available theme variants in display order. */
|
|
28
78
|
export declare const themeVariants: ThemeVariant[];
|
|
29
79
|
/** Look up a theme config by variant name. */
|
|
30
80
|
export declare function getThemeConfig(variant: ThemeVariant): ThemeConfig;
|
|
81
|
+
/**
|
|
82
|
+
* Resolve the card gradient for a given theme variant and colour mode.
|
|
83
|
+
* Falls back to `datalayer` / `light` when values are missing.
|
|
84
|
+
*/
|
|
85
|
+
export declare function getCardGradient(variant?: ThemeVariant, colorMode?: 'light' | 'dark' | 'auto'): GradientPair;
|
|
86
|
+
/**
|
|
87
|
+
* Get the bright (vivid / OpenAI-blog-style) palette for a given theme variant.
|
|
88
|
+
*
|
|
89
|
+
* When `colorMode` is `'light'` the vivid / saturated light-background palette
|
|
90
|
+
* is returned — these are punchy, high-saturation colours designed to keep SVG
|
|
91
|
+
* illustrations vibrant and energetic on near-white surfaces.
|
|
92
|
+
* When `colorMode` is `'auto'`, the OS preference is queried via
|
|
93
|
+
* `prefers-color-scheme` so palettes always match the effective background.
|
|
94
|
+
* Defaults to the dark-optimised neon palette for backward compatibility.
|
|
95
|
+
*/
|
|
96
|
+
export declare function getBrightPalette(variant?: ThemeVariant, colorMode?: 'light' | 'dark' | 'auto'): BrightPalette;
|
|
97
|
+
/**
|
|
98
|
+
* Get a 5-colour avatar palette for the given theme variant and colour mode.
|
|
99
|
+
*
|
|
100
|
+
* Designed for use with the `boring-avatars` library's `colors` prop.
|
|
101
|
+
* When `colorMode` is `'auto'`, the OS preference is queried via
|
|
102
|
+
* `prefers-color-scheme` so avatars always match the effective background.
|
|
103
|
+
* Falls back to `datalayer` / `light` when values are missing.
|
|
104
|
+
*/
|
|
105
|
+
export declare function getAvatarColors(variant?: ThemeVariant, colorMode?: 'light' | 'dark' | 'auto'): string[];
|
|
@@ -19,6 +19,30 @@ export const themeConfigs = {
|
|
|
19
19
|
defaultColorMode: 'auto',
|
|
20
20
|
primerTheme: datalayerTheme,
|
|
21
21
|
themeStyles: datalayerThemeStyles,
|
|
22
|
+
cardGradient: {
|
|
23
|
+
light: { from: datalayerColors.greenBrand, to: datalayerColors.greenText }, // #16A085 → #117A65
|
|
24
|
+
dark: { from: datalayerColors.greenAccent, to: datalayerColors.greenBrand }, // #1ABC9C → #16A085
|
|
25
|
+
},
|
|
26
|
+
brightPalette: {
|
|
27
|
+
glow: datalayerColors.brightGlow, // #00D68F — vivid emerald
|
|
28
|
+
onGlow: '#1b1f24', // dark text on bright green
|
|
29
|
+
pop: datalayerColors.brightPop, // #00E5FF — electric cyan
|
|
30
|
+
spark: datalayerColors.brightSpark, // #76FF03 — lime neon
|
|
31
|
+
blaze: datalayerColors.brightBlaze, // #FF1744 — vivid red
|
|
32
|
+
surge: datalayerColors.brightSurge, // #2979FF — electric blue
|
|
33
|
+
flame: datalayerColors.brightFlame, // #FF6D00 — vivid orange
|
|
34
|
+
gold: datalayerColors.brightGold, // #FFD600 — vivid yellow
|
|
35
|
+
},
|
|
36
|
+
brightPaletteLight: {
|
|
37
|
+
glow: datalayerColors.brightLightGlow, // #00BFA5 — vivid aqua-green
|
|
38
|
+
onGlow: '#1b1f24', // dark text on aqua-green
|
|
39
|
+
pop: datalayerColors.brightLightPop, // #00B0FF — vivid sky blue
|
|
40
|
+
spark: datalayerColors.brightLightSpark, // #64DD17 — vivid chartreuse
|
|
41
|
+
blaze: datalayerColors.brightLightBlaze, // #FF1744 — vivid red
|
|
42
|
+
surge: datalayerColors.brightLightSurge, // #2979FF — electric blue
|
|
43
|
+
flame: datalayerColors.brightLightFlame, // #FF6D00 — vivid orange
|
|
44
|
+
gold: datalayerColors.brightLightGold, // #FFAB00 — vivid amber
|
|
45
|
+
},
|
|
22
46
|
},
|
|
23
47
|
spatial: {
|
|
24
48
|
label: 'Spatial',
|
|
@@ -27,6 +51,30 @@ export const themeConfigs = {
|
|
|
27
51
|
defaultColorMode: 'auto',
|
|
28
52
|
primerTheme: spatialTheme,
|
|
29
53
|
themeStyles: spatialThemeStyles,
|
|
54
|
+
cardGradient: {
|
|
55
|
+
light: { from: spatialColors.indigoBrand, to: spatialColors.indigoText }, // #4F46E5 → #3730A3
|
|
56
|
+
dark: { from: spatialColors.indigoAccent, to: spatialColors.indigoBrand }, // #6366F1 → #4F46E5
|
|
57
|
+
},
|
|
58
|
+
brightPalette: {
|
|
59
|
+
glow: spatialColors.brightGlow, // #7C4DFF — electric violet
|
|
60
|
+
onGlow: '#ffffff', // white text on violet
|
|
61
|
+
pop: spatialColors.brightPop, // #448AFF — neon blue
|
|
62
|
+
spark: spatialColors.brightSpark, // #E040FB — vivid magenta
|
|
63
|
+
blaze: spatialColors.brightBlaze, // #FF5252 — neon red
|
|
64
|
+
surge: spatialColors.brightSurge, // #00B0FF — deep sky blue
|
|
65
|
+
flame: spatialColors.brightFlame, // #FF9100 — amber orange
|
|
66
|
+
gold: spatialColors.brightGold, // #FFEA00 — electric yellow
|
|
67
|
+
},
|
|
68
|
+
brightPaletteLight: {
|
|
69
|
+
glow: spatialColors.brightLightGlow, // #7C4DFF — electric violet
|
|
70
|
+
onGlow: '#ffffff', // white text on violet
|
|
71
|
+
pop: spatialColors.brightLightPop, // #448AFF — neon blue
|
|
72
|
+
spark: spatialColors.brightLightSpark, // #D500F9 — vivid purple
|
|
73
|
+
blaze: spatialColors.brightLightBlaze, // #FF5252 — neon red
|
|
74
|
+
surge: spatialColors.brightLightSurge, // #00B0FF — vivid sky blue
|
|
75
|
+
flame: spatialColors.brightLightFlame, // #FF9100 — vivid amber orange
|
|
76
|
+
gold: spatialColors.brightLightGold, // #FFC400 — vivid gold
|
|
77
|
+
},
|
|
30
78
|
},
|
|
31
79
|
lovely: {
|
|
32
80
|
label: 'Lovely',
|
|
@@ -35,6 +83,30 @@ export const themeConfigs = {
|
|
|
35
83
|
defaultColorMode: 'auto',
|
|
36
84
|
primerTheme: lovelyTheme,
|
|
37
85
|
themeStyles: lovelyThemeStyles,
|
|
86
|
+
cardGradient: {
|
|
87
|
+
light: { from: lovelyColors.roseBrand, to: lovelyColors.roseText }, // #DB2777 → #9D174D
|
|
88
|
+
dark: { from: lovelyColors.roseAccent, to: lovelyColors.roseBrand }, // #EC4899 → #DB2777
|
|
89
|
+
},
|
|
90
|
+
brightPalette: {
|
|
91
|
+
glow: lovelyColors.brightGlow, // #FF4081 — hot pink
|
|
92
|
+
onGlow: '#ffffff', // white text on hot pink
|
|
93
|
+
pop: lovelyColors.brightPop, // #FF6E40 — vivid coral
|
|
94
|
+
spark: lovelyColors.brightSpark, // #EA80FC — electric fuchsia
|
|
95
|
+
blaze: lovelyColors.brightBlaze, // #FF1744 — vivid crimson
|
|
96
|
+
surge: lovelyColors.brightSurge, // #536DFE — indigo blue
|
|
97
|
+
flame: lovelyColors.brightFlame, // #FF6E40 — coral orange
|
|
98
|
+
gold: lovelyColors.brightGold, // #FFD740 — amber gold
|
|
99
|
+
},
|
|
100
|
+
brightPaletteLight: {
|
|
101
|
+
glow: lovelyColors.brightLightGlow, // #FF4081 — hot pink
|
|
102
|
+
onGlow: '#ffffff', // white text on hot pink
|
|
103
|
+
pop: lovelyColors.brightLightPop, // #FF6E40 — vivid coral
|
|
104
|
+
spark: lovelyColors.brightLightSpark, // #EA80FC — electric fuchsia
|
|
105
|
+
blaze: lovelyColors.brightLightBlaze, // #FF1744 — vivid crimson
|
|
106
|
+
surge: lovelyColors.brightLightSurge, // #536DFE — vivid indigo
|
|
107
|
+
flame: lovelyColors.brightLightFlame, // #FF6E40 — vivid coral orange
|
|
108
|
+
gold: lovelyColors.brightLightGold, // #FFD740 — vivid amber gold
|
|
109
|
+
},
|
|
38
110
|
},
|
|
39
111
|
matrix: {
|
|
40
112
|
label: 'Matrix',
|
|
@@ -43,6 +115,30 @@ export const themeConfigs = {
|
|
|
43
115
|
defaultColorMode: 'dark',
|
|
44
116
|
primerTheme: matrixTheme,
|
|
45
117
|
themeStyles: matrixThemeStyles,
|
|
118
|
+
cardGradient: {
|
|
119
|
+
light: { from: matrixColors.greenBrand, to: matrixColors.greenText }, // #16A085 → #117A65
|
|
120
|
+
dark: { from: matrixColors.greenGlow, to: matrixColors.greenHover }, // #39FF14 → #0E6655
|
|
121
|
+
},
|
|
122
|
+
brightPalette: {
|
|
123
|
+
glow: matrixColors.brightGlow, // #39FF14 — neon green
|
|
124
|
+
onGlow: '#1b1f24', // dark text on neon green
|
|
125
|
+
pop: matrixColors.brightPop, // #00FF88 — phosphor cyan
|
|
126
|
+
spark: matrixColors.brightSpark, // #CCFF00 — acid lime
|
|
127
|
+
blaze: matrixColors.brightBlaze, // #FF0040 — matrix red pill
|
|
128
|
+
surge: matrixColors.brightSurge, // #00E5FF — electric blue
|
|
129
|
+
flame: matrixColors.brightFlame, // #FF6D00 — electric orange
|
|
130
|
+
gold: matrixColors.brightGold, // #FFEA00 — glitch yellow
|
|
131
|
+
},
|
|
132
|
+
brightPaletteLight: {
|
|
133
|
+
glow: matrixColors.brightLightGlow, // #00E676 — vivid green
|
|
134
|
+
onGlow: '#1b1f24', // dark text on vivid green
|
|
135
|
+
pop: matrixColors.brightLightPop, // #1DE9B6 — vivid teal-mint
|
|
136
|
+
spark: matrixColors.brightLightSpark, // #AEEA00 — vivid lime
|
|
137
|
+
blaze: matrixColors.brightLightBlaze, // #FF1744 — vivid red
|
|
138
|
+
surge: matrixColors.brightLightSurge, // #00B0FF — vivid sky blue
|
|
139
|
+
flame: matrixColors.brightLightFlame, // #FF6D00 — vivid orange
|
|
140
|
+
gold: matrixColors.brightLightGold, // #FFAB00 — vivid amber
|
|
141
|
+
},
|
|
46
142
|
},
|
|
47
143
|
};
|
|
48
144
|
/** All available theme variants in display order. */
|
|
@@ -51,3 +147,142 @@ export const themeVariants = ['datalayer', 'spatial', 'lovely', 'matrix'];
|
|
|
51
147
|
export function getThemeConfig(variant) {
|
|
52
148
|
return themeConfigs[variant];
|
|
53
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Resolve the card gradient for a given theme variant and colour mode.
|
|
152
|
+
* Falls back to `datalayer` / `light` when values are missing.
|
|
153
|
+
*/
|
|
154
|
+
export function getCardGradient(variant = 'datalayer', colorMode = 'light') {
|
|
155
|
+
const mode = colorMode === 'auto' ? 'light' : colorMode;
|
|
156
|
+
return themeConfigs[variant]?.cardGradient?.[mode] ?? themeConfigs.datalayer.cardGradient.light;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Get the bright (vivid / OpenAI-blog-style) palette for a given theme variant.
|
|
160
|
+
*
|
|
161
|
+
* When `colorMode` is `'light'` the vivid / saturated light-background palette
|
|
162
|
+
* is returned — these are punchy, high-saturation colours designed to keep SVG
|
|
163
|
+
* illustrations vibrant and energetic on near-white surfaces.
|
|
164
|
+
* When `colorMode` is `'auto'`, the OS preference is queried via
|
|
165
|
+
* `prefers-color-scheme` so palettes always match the effective background.
|
|
166
|
+
* Defaults to the dark-optimised neon palette for backward compatibility.
|
|
167
|
+
*/
|
|
168
|
+
export function getBrightPalette(variant = 'datalayer', colorMode) {
|
|
169
|
+
const cfg = themeConfigs[variant] ?? themeConfigs.datalayer;
|
|
170
|
+
let resolvedMode;
|
|
171
|
+
if (colorMode === 'auto') {
|
|
172
|
+
resolvedMode =
|
|
173
|
+
typeof window !== 'undefined' &&
|
|
174
|
+
window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
175
|
+
? 'dark'
|
|
176
|
+
: 'light';
|
|
177
|
+
}
|
|
178
|
+
else if (colorMode === 'light') {
|
|
179
|
+
resolvedMode = 'light';
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
resolvedMode = 'dark';
|
|
183
|
+
}
|
|
184
|
+
if (resolvedMode === 'light') {
|
|
185
|
+
return cfg.brightPaletteLight ?? cfg.brightPalette;
|
|
186
|
+
}
|
|
187
|
+
return cfg.brightPalette;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Avatar colour palettes per theme × colour mode.
|
|
191
|
+
*
|
|
192
|
+
* Each palette is a 5-colour array tuned for the `boring-avatars` library.
|
|
193
|
+
* The colours are picked from each theme's brand + bright palette so the
|
|
194
|
+
* avatar always feels native to the current theme.
|
|
195
|
+
*
|
|
196
|
+
* - **Light mode** uses the deeper / accessible colour variants so the
|
|
197
|
+
* avatar is legible on light backgrounds.
|
|
198
|
+
* - **Dark mode** uses the brighter / glowing variants so the avatar
|
|
199
|
+
* pops against dark surfaces.
|
|
200
|
+
*/
|
|
201
|
+
const avatarColorPalettes = {
|
|
202
|
+
datalayer: {
|
|
203
|
+
light: [
|
|
204
|
+
datalayerColors.greenText, // #117A65 — deep green
|
|
205
|
+
datalayerColors.greenBrand, // #16A085 — brand green
|
|
206
|
+
datalayerColors.brightLightPop, // #00B0FF — sky blue
|
|
207
|
+
datalayerColors.brightLightGold, // #FFAB00 — amber
|
|
208
|
+
datalayerColors.gray, // #59595C — neutral
|
|
209
|
+
],
|
|
210
|
+
dark: [
|
|
211
|
+
datalayerColors.greenAccent, // #1ABC9C — bright teal
|
|
212
|
+
datalayerColors.greenBright, // #2ECC71 — bright green
|
|
213
|
+
datalayerColors.brightPop, // #00E5FF — electric cyan
|
|
214
|
+
datalayerColors.brightGold, // #FFD600 — vivid yellow
|
|
215
|
+
datalayerColors.brightFlame, // #FF6D00 — vivid orange
|
|
216
|
+
],
|
|
217
|
+
},
|
|
218
|
+
spatial: {
|
|
219
|
+
light: [
|
|
220
|
+
spatialColors.indigoText, // #3730A3 — deep indigo
|
|
221
|
+
spatialColors.indigoBrand, // #4F46E5 — brand indigo
|
|
222
|
+
spatialColors.brightLightSpark, // #D500F9 — vivid purple
|
|
223
|
+
spatialColors.brightLightGold, // #FFC400 — vivid gold
|
|
224
|
+
spatialColors.gray, // #8892B0 — nebula gray
|
|
225
|
+
],
|
|
226
|
+
dark: [
|
|
227
|
+
spatialColors.indigoAccent, // #6366F1 — bright indigo
|
|
228
|
+
spatialColors.indigoBright, // #818CF8 — light indigo
|
|
229
|
+
spatialColors.brightPop, // #448AFF — neon blue
|
|
230
|
+
spatialColors.brightSpark, // #E040FB — vivid magenta
|
|
231
|
+
spatialColors.brightGold, // #FFEA00 — electric yellow
|
|
232
|
+
],
|
|
233
|
+
},
|
|
234
|
+
lovely: {
|
|
235
|
+
light: [
|
|
236
|
+
lovelyColors.roseText, // #9D174D — deep rose
|
|
237
|
+
lovelyColors.roseBrand, // #DB2777 — brand pink
|
|
238
|
+
lovelyColors.brightLightSurge, // #536DFE — vivid indigo
|
|
239
|
+
lovelyColors.brightLightGold, // #FFD740 — amber gold
|
|
240
|
+
lovelyColors.gray, // #9D7A8F — mauve gray
|
|
241
|
+
],
|
|
242
|
+
dark: [
|
|
243
|
+
lovelyColors.roseAccent, // #EC4899 — bright pink
|
|
244
|
+
lovelyColors.roseBright, // #F472B6 — light pink
|
|
245
|
+
lovelyColors.brightPop, // #FF6E40 — vivid coral
|
|
246
|
+
lovelyColors.brightSpark, // #EA80FC — electric fuchsia
|
|
247
|
+
lovelyColors.brightGold, // #FFD740 — amber gold
|
|
248
|
+
],
|
|
249
|
+
},
|
|
250
|
+
matrix: {
|
|
251
|
+
light: [
|
|
252
|
+
matrixColors.greenText, // #117A65 — deep green
|
|
253
|
+
matrixColors.greenBrand, // #16A085 — brand green
|
|
254
|
+
matrixColors.brightLightPop, // #1DE9B6 — vivid teal
|
|
255
|
+
matrixColors.brightLightGold, // #FFAB00 — vivid amber
|
|
256
|
+
matrixColors.gray, // #4A7856 — dim green-gray
|
|
257
|
+
],
|
|
258
|
+
dark: [
|
|
259
|
+
matrixColors.greenPhosphor, // #00FF41 — Matrix green
|
|
260
|
+
matrixColors.greenGlow, // #39FF14 — neon phosphor
|
|
261
|
+
matrixColors.brightPop, // #00FF88 — phosphor cyan
|
|
262
|
+
matrixColors.brightSpark, // #CCFF00 — acid lime
|
|
263
|
+
matrixColors.brightSurge, // #00E5FF — electric blue
|
|
264
|
+
],
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Get a 5-colour avatar palette for the given theme variant and colour mode.
|
|
269
|
+
*
|
|
270
|
+
* Designed for use with the `boring-avatars` library's `colors` prop.
|
|
271
|
+
* When `colorMode` is `'auto'`, the OS preference is queried via
|
|
272
|
+
* `prefers-color-scheme` so avatars always match the effective background.
|
|
273
|
+
* Falls back to `datalayer` / `light` when values are missing.
|
|
274
|
+
*/
|
|
275
|
+
export function getAvatarColors(variant = 'datalayer', colorMode = 'light') {
|
|
276
|
+
let mode;
|
|
277
|
+
if (colorMode === 'auto') {
|
|
278
|
+
mode =
|
|
279
|
+
typeof window !== 'undefined' &&
|
|
280
|
+
window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
281
|
+
? 'dark'
|
|
282
|
+
: 'light';
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
mode = colorMode;
|
|
286
|
+
}
|
|
287
|
+
return avatarColorPalettes[variant]?.[mode] ?? avatarColorPalettes.datalayer.light;
|
|
288
|
+
}
|
|
@@ -118,6 +118,10 @@ export interface ThemeColorDefs {
|
|
|
118
118
|
* | Outline button | `--button-outline-fgColor-rest` |
|
|
119
119
|
* | Danger button | `--button-danger-bgColor-hover` |
|
|
120
120
|
* | Button counters | `--buttonCounter-primary-bgColor-rest` |
|
|
121
|
+
* | Control track | `--controlTrack-bgColor-rest` |
|
|
122
|
+
* | Control checked | `--control-checked-bgColor-rest` |
|
|
123
|
+
* | Control knob | `--controlKnob-bgColor-rest` |
|
|
124
|
+
* | List hover | `--control-transparent-bgColor-hover` |
|
|
121
125
|
* | Legacy aliases | `--color-btn-primary-bg` |
|
|
122
126
|
* | Brand (custom) | `--brand-color-canvas-default` |
|
|
123
127
|
*/
|
|
@@ -131,5 +135,14 @@ export interface ThemeStyles {
|
|
|
131
135
|
* Build a complete `ThemeStyles` object from light / dark
|
|
132
136
|
* `ThemeColorDefs`. The result is ready to pass straight to
|
|
133
137
|
* `<DatalayerThemeProvider themeStyles={…}>`.
|
|
138
|
+
*
|
|
139
|
+
* @param options.fontFamily When supplied, the Primer font-stack
|
|
140
|
+
* CSS custom properties (`--fontStack-sansSerif`,
|
|
141
|
+
* `--fontStack-sansSerifDisplay`) are overridden so that every
|
|
142
|
+
* Primer component that uses the CSS `font` shorthand (e.g.
|
|
143
|
+
* `Blankslate`) picks up the themed font instead of the
|
|
144
|
+
* hard-coded system-font fallback.
|
|
134
145
|
*/
|
|
135
|
-
export declare function buildThemeStyles(light: ThemeColorDefs, dark: ThemeColorDefs
|
|
146
|
+
export declare function buildThemeStyles(light: ThemeColorDefs, dark: ThemeColorDefs, options?: {
|
|
147
|
+
fontFamily?: string;
|
|
148
|
+
}): ThemeStyles;
|