Skip to content

Theme Overrides should use theme variables #4

@joebochill

Description

@joebochill

Describe the desired behavior

Theme styleOverrides should be built using the theme variable/function instead of hardcoding colors.

Describe the current behavior

The current styleOverrides in the theme use hardcoded colors (e.g., from ThemeColors or BLUIColors variables):

image

This causes problems when trying to do custom themes that 'extend' our base theme (e.g., we want to change the primary color but keep all of the non-color based theme settings like fonts, etc.). Because these colors are hardcoded in the overrides, even if you set the primary color to 'red' (for example), you'll still see a #007BC1 FAB.

Is this request related to a current issue?

This was discovered when working on holiday themes on the doc site.

Additional Context

https://mui.com/material-ui/customization/theme-components/#overrides-based-on-props

For example:

- primary: {
+ primary: ({ ownerState, theme }) => ({
-    backgroundColor: ThemeColors.primary.main,
+    backgroundColor: theme.palette.primary.main,
-    color: WhiteText,
+    color: theme.palette.common.white
     "&:hover": {
-        backgroundColor: BLUIColors.blue[300],
+        backgroundColor: theme.palette.primary.light
     },
- }
+ })

Metadata

Metadata

Assignees

No one assigned

    Labels

    brightlayer-uiset to identify Brightlayer UI platform issues for easy filteringthemesissues related to themetype: enhancement 🚀An improvement or extension to existing functionality, design, or performance or feature request.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions