Description
The design system's theme handling in the twrnc preset currently includes an unused ColorSet enum that adds unnecessary complexity to the codebase. This abstraction was originally created to support multiple color sets (Brand, Neutral, etc.), but in practice, we only use the 'Brand' color set. This creates unnecessary nesting and type complexity that should be removed to simplify the codebase.
Technical Details
Current structure has unnecessary nesting:
export enum ColorSet {
Brand = 'brand',
}
export const colorSetList: ColorSetListProps = {
[ColorSet.Brand]: {
[ColorScheme.Light]: flattenColors(lightTheme.colors),
[ColorScheme.Dark]: flattenColors(darkTheme.colors),
},
};
Changes needed:
- Remove
ColorSet enum and related types
- Flatten color set list structure to directly map color schemes to colors
- Update
generateTailwindConfig to work with ColorScheme directly
- Update
ThemeProvider and ThemeContext to remove ColorSet references
- Update exports to remove ColorSet
- Convert font sizes to strings to match twrnc requirements
Acceptance Criteria
References
- Related to theme handling in design system
- Affects
@metamask/design-system-twrnc-preset package
- Improves code maintainability by removing unused abstraction
- Simplifies type system and reduces complexity
Description
The design system's theme handling in the twrnc preset currently includes an unused
ColorSetenum that adds unnecessary complexity to the codebase. This abstraction was originally created to support multiple color sets (Brand, Neutral, etc.), but in practice, we only use the 'Brand' color set. This creates unnecessary nesting and type complexity that should be removed to simplify the codebase.Technical Details
Current structure has unnecessary nesting:
Changes needed:
ColorSetenum and related typesgenerateTailwindConfigto work withColorSchemedirectlyThemeProviderandThemeContextto remove ColorSet referencesAcceptance Criteria
ColorSetenum and related types are removedReferences
@metamask/design-system-twrnc-presetpackage