Hey 👋🏻
The docs and JSDoc for ThemeContext.colors describe it as:
A computed reference to the resolved colors of the current theme.
However, the runtime implementation iterates over all registered themes and returns Record<string, Colors> where the outer key is the theme, not just the current theme's colors.
By the way, I always wondered, why not have interface augmentation so we would have type-safe accessing of theme colors? Right now, Colors is Record<string, string>, so there's no autocomplete or typo protection:
const theme = useTheme()
theme.colors.value['light'].primary // works but no autocompletion
theme.colors.value['light'].primray // silent typo — no error
Something like an augmentable ThemeColorOverrides interface would make this type-safe without breaking existing behavior.
Thanks in advance🙏🏻
Hey 👋🏻
The docs and JSDoc for
ThemeContext.colorsdescribe it as:However, the runtime implementation iterates over all registered themes and returns
Record<string, Colors>where the outer key is the theme, not just the current theme's colors.By the way, I always wondered, why not have interface augmentation so we would have type-safe accessing of theme colors? Right now,
ColorsisRecord<string, string>, so there's no autocomplete or typo protection:Something like an augmentable
ThemeColorOverridesinterface would make this type-safe without breaking existing behavior.Thanks in advance🙏🏻