Theming
Theme Hooks
Utility hooks for accessing theme colors and state in your components.
Theme Hooks
The app provides utility hooks that make it easy to access theme information and colors in your components. These hooks allow for more programmatic control over theming when Tailwind classes aren't sufficient.
Available Hooks
useTheme
The useTheme
hook provides access to the current theme state and a function to toggle it:
useThemeColors
The useThemeColors
hook provides programmatic access to all theme colors:
useThemeColors Properties
The useThemeColors
hook returns an object with these properties:
Property | Description | Light Value | Dark Value |
---|---|---|---|
bg | Primary background | #ffffff | #14212D |
secondary | Secondary background | #E2E8F0 | #324650 |
text | Text color | black | white |
highlight | Accent color | #0EA5E9 | #0EA5E9 |
border | Border color | #E2E8F0 | #404040 |
icon | Icon color | black | white |
placeholder | Placeholder text | #A5ABB4 | #697F8D |
isDark | Is dark mode active | false | true |
When to Use Hooks vs Tailwind
Use Tailwind Classes When:
- Styling basic properties like background, text color, borders
- Working with components that support className (like NativeWind components)
- Applying responsive design patterns
Use Theme Hooks When:
- Working with components that don't support className
- Needing dynamic styles based on theme and other state
- Creating animations that depend on theme colors
- Working with libraries that require style objects
Combining Approaches
You can combine both approaches for maximum flexibility: