Overview
Hux UI provides a comprehensive theming system based on design tokens that automatically adapt to light and dark modes. The theming system separates primitive colors from semantic tokens, following modern design system best practices.Design System Reference: Explore the complete design system, including all colors, tokens, and component specifications in our Figma library.
Theme Configuration
Basic Setup
Configure light and dark themes in your app:main.dart
Dynamic Theme Switching
Implement theme switching in your app:Design Tokens
Hux UI uses semantic design tokens through theHuxTokens
class. These tokens automatically adapt to the current theme.
Text Tokens
Surface Tokens
Border Tokens
Status Tokens
Custom Colors
Using Preset Colors
Hux UI provides several preset colors for customization:Custom Colors
Use any custom color with Hux UI components:Color Accessibility
Hux UI automatically ensures WCAG AA contrast compliance:Advanced Theming
Custom Theme Extensions
Extend Hux themes with your own customizations:Theme-Aware Widgets
Create widgets that respond to theme changes:Best Practices
Use Semantic Tokens
Use Semantic Tokens
Always use
HuxTokens
instead of hardcoded colors:Test Both Themes
Test Both Themes
Always test your UI in both light and dark modes:
Consistent Spacing
Consistent Spacing
Use consistent spacing that works with the theme:
Accessibility
Accessibility
Leverage automatic contrast calculation:
Color Reference
Preset Colors
Name | Light Mode | Dark Mode | Hex Code |
---|---|---|---|
Default | Black | White | Dynamic |
Indigo | Indigo | Indigo | #665CFF |
Green | Green | Green | #2E7252 |
Pink | Pink | Pink | #DF1D54 |
Status Colors
Status | Purpose | Light Mode | Dark Mode |
---|---|---|---|
Success | Positive actions | Dark Green | Light Green |
Destructive | Errors, warnings | Dark Red | Light Red |
Token Categories
- Text: Primary, Secondary, Tertiary, Disabled, Inverted
- Surface: Primary, Secondary, Elevated, Hover
- Border: Primary, Secondary, Destructive, Success
- Button: Secondary Background, Secondary Text, Secondary Border
- Icon: Primary, Secondary
- Chart: Grid, Axis, Axis Text