Skip to content

feat: allow for theme color fallbacks for overrides #456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2025
Merged

Conversation

serikjensen
Copy link
Member

@serikjensen serikjensen commented Aug 11, 2025

This PR enables theme color fallbacks for overrides.

Without this change, the consumer would have to specify each color property individually. For example, even if they set colorErrorAccent, they would also have to set inputErrorColor, even though inputErrorColor uses the same value as colorErrorAccent.

This updates so that the partner could specify colorErrorAccent (or other colors) and the input colors would get those values by default. The consumer could then specify their own inputErrorColor if they had a distinct one, but this enables them to set less colors as a baseline if they don't want to fine tune.

This approach could be expanded to things like typography values, but focusing on colors for now.

We still use the return type of createTheme to type the theme properties. So we still automatically get updates to the theme type as properties are added either to createTheme or the base theme colors.

Proof of functionality

Theme configuration for colorBody:

Screenshot 2025-08-12 at 9 23 03 AM

Results in the following input backgrounds automatically

Screenshot 2025-08-12 at 9 23 43 AM

If we then specify a specific color value for inputBackgroundColor as well as a colorBody value:

Screenshot 2025-08-12 at 9 24 34 AM

The inputBackgroundColor takes precedence:

Screenshot 2025-08-12 at 9 24 16 AM

@serikjensen serikjensen force-pushed the feat/GWS-5377 branch 2 times, most recently from 8a2b472 to 5ef9e75 Compare August 12, 2025 15:53
@serikjensen serikjensen changed the title WIP: allow for theme color overrides feat: allow for theme color fallbacks for overrides Aug 12, 2025
@serikjensen serikjensen marked this pull request as ready for review August 12, 2025 16:01
Copy link
Contributor

@jeffredodd jeffredodd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
Crocodile Hunter Yes

@serikjensen serikjensen merged commit 1467a56 into main Aug 13, 2025
3 checks passed
@serikjensen serikjensen deleted the feat/GWS-5377 branch August 13, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants