Skip to content

Design tokens / Dark mode #66

@techniq

Description

@techniq

Use CSS variables and/or extend Tailwind color palette to easily support dark mode, and provide more flexibility for styling customization beyond accent color and theme support (per-component classes)

Design token comparison spreadsheet


Thoughts / Questions

  • What to call text/content on a color?
    • COLOR-content (daisy), COLOR-foreground (shadcn), on-COLOR (skeleton), COLOR-text (~open props)
  • What to call main background?
    • base-100 (daisy), background (shadcn)
  • What to call main text color
    • base-content (daisy), foreground (shadcn), font-color-base (skeleton), text-1 (open props)
  • What color space to use (hsl, rgb, oklch)?
    • rgb()
      • Most universal, used by Tailwind, Skeleton
    • hsl()
      • Probably the most developer friendly ATM
      • Used by shadcn
    • oklch()
      • Only supported in last 1-2 years (Safari 15.4+).
      • Supports P3 colors
      • Used by Daisy UI
  • Additional properties like general borders, roundness, etc
  • Should use explicit colors (most) or shades (skeleton, next-ui)
    • Shades support nice pairings (skeleton) but explicit are easier to setup (and more generally used)
    • Shades allow for darker shades without having to use color-mix(), which only has support this year (Safari 16.2, Chrome 111)
  • Ability to reuse themes
  • Should hovered filled buttons get more transparent, lighter, darker?
    • Currently getting darker
    • Using color-mix() works for any of these, but only supported in last 8-12 months? Progressive enhancement, or find way to fallback to using opacity
  • Should each component expose their own colors (like Button for --bg-color, --text-color, --border-color, etc) or is setting --ux-primary / --ux-primary-content sufficient
    • Would be a descent lift, but maybe worth it
    • Some components already expose CSS variables for styling (ProgressBar as --color, Field/TextField). Switch current uses explicit bg-*, border-* but might be worth changing
  • When should we use primary, secondary, accent, neutral, etc? Always primary unless explicit?

TODO

  • Determine tokens (colors, borders, etc)
  • Update all components to use tokens
  • Add dark mode (and maybe other themes)
  • Ability to switch themes
  • Consider renaming current settings: {{ theme: ... }} to classes or overrides
  • Support defining theme in tailwind config
  • Add examples for mappings existing themes
    • Daisy UI
    • Skeleton
    • Basic tailwind colors
  • Debate on using bg-mix-[theme(colors.primary)/+90] instead of bg-primary-50 (and +80 / -100)
    • Added lighter/darker shades for all theme colors (ex. colors.primary-600)
  • Support changing color space (oklch, hsl, rgb)
  • Remove usage of old CSS variables var(--color-blue-100), etc (tableBackground, etc)
  • Color replacement
    • Replace bg-white with bg-surface-100 (or similar)
    • Replace text-black with text-surface-content (or similar)
    • Replace bg-black (and bg-black/5, bg-black/50, etc) possibly with bg-surface-content
    • Replace border-* colors
    • Replace *-black-*
    • Replace *-white-*
    • Replace *-gray-*
    • Replace #ddd
    • All old color references (look for -500, etc). Example: Table's var(--color-blue-500)
  • Globally change the default border color to border-surface-300
  • Rename --ux-{COLOR} to --color-{COLOR} (after current --color* variables are evaluated
  • Add more colors
    • accent
    • neutral
  • Rename error color to danger
  • Add borders (and other styles) to config
  • Refine/remove default Drawer/Dialog action styles
  • Update mdsvex code background (like <Code>/<Preview>)
  • Fix tailwind prose classes (markdown pages)
  • Consider setting <input> default background with global styles (same for scrollbars - Scrollbar styling (globally or util class) #122)
  • Improve handling of system color scheme / theme in ThemeButton
  • Remove daisyui required dependency (see LayerChart issue)
    • Possible become separate package
    • Maybe just generate theme.json file that can be easily referenced
  • Add default light / dark themes
  • Update templates
  • Update Customization guide

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions