Skip to content

Commit bcd1e57

Browse files
committed
design-tokens(tailwind): add explicit [data-theme='light'], .light variables to allow nested light override of .dark context in Storybook and consumers
1 parent 700071a commit bcd1e57

1 file changed

Lines changed: 167 additions & 0 deletions

File tree

packages/design-tokens/src/tailwind/theme.css

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,173 @@
344344
--color-shadow-error: #ff758433;
345345
}
346346

347+
/**
348+
* Light Theme Colors
349+
* Explicitly re-apply light values so `.light` (or [data-theme='light'])
350+
* can override a surrounding `.dark` context.
351+
*/
352+
[data-theme='light'],
353+
.light {
354+
/* Background default should be the darkest shade, 0 elevation.
355+
Section is +1 elevation, subsection is +2 elevation.
356+
Alternative should be deprecated. */
357+
--color-background-default: var(--brand-colors-grey-grey000);
358+
--color-background-section: var(--brand-colors-grey-grey050);
359+
--color-background-subsection: var(--brand-colors-grey-grey000);
360+
--color-background-alternative: var(--brand-colors-grey-grey050);
361+
362+
/* Applied to interactive elements, such as buttons.
363+
For light mode, we use 8% increments of opacity to offer
364+
sufficient affordance for usability. */
365+
--color-background-muted: #b4b4b528;
366+
--color-background-muted-hover: #b4b4b53d;
367+
--color-background-muted-pressed: #b4b4b552;
368+
369+
/* Ensures visual consistency with section and subsection. */
370+
--color-background-default-hover: var(--brand-colors-grey-grey050);
371+
--color-background-default-pressed: var(--brand-colors-grey-grey100);
372+
373+
/* These colors should be deprecated eventually for simplicity */
374+
--color-background-alternative-hover: #ebedf1;
375+
--color-background-alternative-pressed: #e1e4ea;
376+
377+
/* These have opacities of pure white for general usage.
378+
Visually, they align with section and subsection.*/
379+
--color-background-hover: #b4b4b528;
380+
--color-background-pressed: #b4b4b53d;
381+
382+
/* These are our content colors.
383+
Contrast ratio of alternative: 5.7 on default, 5.1 on section.
384+
Contrast ratio of muted: 1.9 on default, 1.7 on section.*/
385+
--color-text-default: var(--brand-colors-grey-grey900);
386+
--color-text-alternative: var(--brand-colors-grey-grey500);
387+
--color-text-muted: var(--brand-colors-grey-grey200);
388+
389+
--color-icon-default: var(--brand-colors-grey-grey900);
390+
--color-icon-default-hover: #2a2b2c;
391+
--color-icon-default-pressed: #414243;
392+
393+
--color-icon-alternative: var(--brand-colors-grey-grey500);
394+
--color-icon-muted: var(--brand-colors-grey-grey200);
395+
--color-icon-inverse: var(--brand-colors-grey-grey000);
396+
397+
/* Border default has a 3:3 ratio when applied on bg-default
398+
and 3.0 on section. We use opacity for border-muted so it
399+
maintains sufficient contrast on bg-default and bg-section.*/
400+
--color-border-default: var(--brand-colors-grey-grey400);
401+
--color-border-muted: #b4b4b566;
402+
403+
/* Derived from the background hue, 264.5, for consistency.
404+
Opacity for default is 36%, alternative is 57%. Default is meant
405+
to be the inverse of dark mode so the layering feels consistent
406+
across themes. Alternative is relatively darker in light mode for
407+
better contrast.*/
408+
--color-overlay-default: #0a0d135c;
409+
--color-overlay-alternative: #0a0d1392;
410+
--color-overlay-inverse: var(--brand-colors-grey-grey000);
411+
412+
/* For primary semantic elements: interactive, active, selected (#4459ff) */
413+
--color-primary-default: var(--brand-colors-blue-blue500);
414+
/* Stronger color for primary semantic elements (#2c3dc5) */
415+
--color-primary-alternative: var(--brand-colors-blue-blue600);
416+
/* Muted color for primary semantic elements (#4459ff1a) */
417+
--color-primary-muted: #4459ff1a;
418+
/* For elements placed on top of primary/default (#ffffff) */
419+
--color-primary-inverse: var(--brand-colors-grey-grey000);
420+
/* Hover state surface for primary/default (#384df5) */
421+
--color-primary-default-hover: #384df5;
422+
/* Pressed state surface for primary/default (#2b3eda) */
423+
--color-primary-default-pressed: #2b3eda;
424+
/* Hover state surface for primary/muted (#4459ff26) */
425+
--color-primary-muted-hover: #4459ff26;
426+
/* Pressed state surface for primary/muted (#4459ff33) */
427+
--color-primary-muted-pressed: #4459ff33;
428+
/* For danger semantic elements: error, critical, destructive (#ca3542) */
429+
--color-error-default: var(--brand-colors-red-red500);
430+
/* Stronger color for error semantic (#952731) */
431+
--color-error-alternative: var(--brand-colors-red-red600);
432+
/* Muted color for error semantic (#ca35421a) */
433+
--color-error-muted: #ca35421a;
434+
/* For elements placed on top of error/default (#ffffff) */
435+
--color-error-inverse: var(--brand-colors-grey-grey000);
436+
/* Hover state surface for error/default (#ba313d) */
437+
--color-error-default-hover: #ba313d;
438+
/* Pressed state surface for error/default (#9a2832) */
439+
--color-error-default-pressed: #9a2832;
440+
/* Hover state surface for error/muted (#ca354226) */
441+
--color-error-muted-hover: #ca354226;
442+
/* Pressed state surface for error/muted (#ca354233) */
443+
--color-error-muted-pressed: #ca354233;
444+
/* For warning semantic elements: caution, attention, precaution (#9a6300) */
445+
--color-warning-default: var(--brand-colors-yellow-yellow500);
446+
/* Muted color option for warning semantic (#9a63001a) */
447+
--color-warning-muted: #9a63001a;
448+
/* For elements placed on top of warning/default (#ffffff) */
449+
--color-warning-inverse: var(--brand-colors-grey-grey000);
450+
/* Hover state surface for warning/default (#855500) */
451+
--color-warning-default-hover: #855500;
452+
/* Pressed state surface for warning/default (#5c3b00) */
453+
--color-warning-default-pressed: #5c3b00;
454+
/* Hover state surface for warning/muted (#9a630026) */
455+
--color-warning-muted-hover: #9a630026;
456+
/* Pressed state surface for warning/muted (#9a630033) */
457+
--color-warning-muted-pressed: #9a630033;
458+
/* For positive semantic elements: success, confirm, complete, safe (#457A39) */
459+
--color-success-default: var(--brand-colors-lime-lime500);
460+
/* Muted color for positive semantic (#457a391a) */
461+
--color-success-muted: #457a391a;
462+
/* For elements placed on top of success/default (#ffffff) */
463+
--color-success-inverse: var(--brand-colors-grey-grey000);
464+
/* Hover state surface for success/default (#3d6c32) */
465+
--color-success-default-hover: #3d6c32;
466+
/* Pressed state surface for success/default (#2d5025) */
467+
--color-success-default-pressed: #2d5025;
468+
/* Hover state surface for success/muted (#457a3926) */
469+
--color-success-muted-hover: #457a3926;
470+
/* Pressed state surface for success/muted (#457a3933) */
471+
--color-success-muted-pressed: #457a3933;
472+
/* For informational read-only elements: info, reminder, hint (#4459ff) */
473+
--color-info-default: var(--brand-colors-blue-blue500);
474+
/* Muted color for informational semantic (#4459ff1a) */
475+
--color-info-muted: #4459ff1a;
476+
/* For elements placed on top of info/default (#ffffff) */
477+
--color-info-inverse: var(--brand-colors-grey-grey000);
478+
/* Expressive color in light orange (#ffa680) */
479+
--color-accent01-light: var(--brand-colors-orange-orange200);
480+
/* Expressive color in orange (#ff5c16) */
481+
--color-accent01-normal: var(--brand-colors-orange-orange400);
482+
/* Expressive color in dark orange (#661800) */
483+
--color-accent01-dark: var(--brand-colors-orange-orange700);
484+
/* Expressive color in light purple (#eac2ff) */
485+
--color-accent02-light: var(--brand-colors-purple-purple100);
486+
/* Expressive color in purple (#d075ff) */
487+
--color-accent02-normal: var(--brand-colors-purple-purple300);
488+
/* Expressive color in dark purple (#3d065f) */
489+
--color-accent02-dark: var(--brand-colors-purple-purple800);
490+
/* Expressive color in light lime (#e5ffc3) */
491+
--color-accent03-light: var(--brand-colors-lime-lime050);
492+
/* Expressive color in lime (#baf24a) */
493+
--color-accent03-normal: var(--brand-colors-lime-lime100);
494+
/* Expressive color in dark lime (#013330) */
495+
--color-accent03-dark: var(--brand-colors-lime-lime700);
496+
/* Expressive color in light indigo (#) */
497+
--color-accent04-light: var(--brand-colors-indigo-indigo100);
498+
/* Expressive color in indigo (#) */
499+
--color-accent04-normal: var(--brand-colors-indigo-indigo200);
500+
/* Expressive color in dark indigo (#) */
501+
--color-accent04-dark: var(--brand-colors-indigo-indigo800);
502+
/* For Flask primary accent color (#8f44e4) */
503+
--color-flask-default: var(--brand-colors-purple-purple500);
504+
/* For elements placed on top of flask/default (#ffffff) */
505+
--color-flask-inverse: var(--brand-colors-grey-grey000);
506+
/* For neutral drop shadow color (black-10% | black-40%) */
507+
--color-shadow-default: #0000001a;
508+
/* For primary drop shadow color (blue500-20% | blue300-20%) */
509+
--color-shadow-primary: #4459ff33;
510+
/* For critical/danger drop shadow color (red50-20% | red300-20%) */
511+
--color-shadow-error: #ca354266;
512+
}
513+
347514
/* Color Shortcut Utilities - Enable shorter class names */
348515
/* Text shortcuts: text-default instead of text-text-default */
349516
@utility text-default {

0 commit comments

Comments
 (0)