Open zanivan opened 1 year ago
For the record, I'm the other guy involved in the Discord discussion.
If the background colors are meant to be a scale, instead of enforcing what bg color should each type of component use, then I believe the proposed changes are better at reflecting that.
But this raises a question, if a section of a page, e.g., drawer, is using level-1 as the background, should elements in it, e.g., chips, keep using level-1 as the background (current behavior), or should they be auto bumped to level-2?
But this raises a question, if a section of a page, e.g., drawer, is using level-1 as the background, should elements in it, e.g., chips, keep using level-1 as the background (current behavior), or should they be auto bumped to level-2?
IMHO by default, they should keep their level for the consistency sake, at least for the Joy UI default theme—otherwise, we can end up with a lot of visuals for the same components. However, if this 'background auto-adjust' is something that would really improve the DX, I believe it could work like a feature, similar to what we have with color inversion
.
In the meantime, I believe changing the name already helps users to better understand and tweak the levels as they need.
But this raises a question, if a section of a page, e.g., drawer, is using level-1 as the background, should elements in it, e.g., chips, keep using level-1 as the background (current behavior), or should they be auto bumped to level-2?
IMHO by default, they should keep their level for the consistency sake, at least for the Joy UI default theme—otherwise, we can end up with a lot of visuals for the same components. However, if this 'background auto-adjust' is something that would really improve the DX, I believe it could work like a feature, similar to what we have with
color inversion
.In the meantime, I believe changing the name already helps users to better understand and tweak the levels as they need.
Totally agree with @zanivan. For context, the body
and surface
are meant to create confidence for customization. For example, as a Joy UI new user, if I want to change the background of the app I can update the background.body
without worrying that the rest of the app will change.
But maybe it's better to go with just scale. What's important is the docs that we should cleary communicate how the scale works.
Duplicates
Latest version
Summary 💡
After a Discord discussion, I wondered if the background scale naming that we currently have on Joy UI is the best one.
Today, the scale works linearly from light to dark, when in dark mode, and from dark to light when in dark mode. We have 7 surface levels, where the
body
is the first level, andlevel3
being the last.Body
, as the name says, is meant for the<body>
, like the base background. In turn, the surface level is used by the components, like the first layer above the<body>
, and level1 to 3 subsequently.The biggest problem is that some names have a semantic approach (body, surface, tooltip, popup) and some have non-semantical names (level 1, level 2 and level 3). This ends up providing a bad DX since it's non-intuitive to know that this is meant to be a linear scale.
Examples 🌈
For instance, these are the scales we currently have for light background:
Proposal
As I see, a better experience for this would be: