New color token layering models #7743
Replies: 10 comments 20 replies
-
Proposal 1: Layering setsThis proposal expands on the concept of the "light" variant (adding a third color variant). It bakes the staking model into each of the 4 themes by creating a specific set of tokens to pair witth each layer and the elements that goes on it. How it works:LayersLayers are the main backgrounds and canvas areas that stack on top of one another. They are sequential and should always stack in order. Example:
SetsThere are three "sets" of layer tokens. Each layer set has the exact same elements in it but will be assigned a different value according to its layer modal. The tokens are defined by a unique number to group the paired set together. Example: Set 1:
Set 2:
Using setsWhich number set you use is determined by which layer you are placing components on. If you are building on Once you've added a new layer to your layout, you would then begin using the next set of tokens. Consequences:
Questions:
|
Beta Was this translation helpful? Give feedback.
-
Proposal 2: Inline themingInline theming is the concept of calling one theme while within another theme. The themes are no longer standalone entities (after that first layer) but would need to work together to create a full experience. Note: How inline theming will be built is not defined in this issue (atm). See #7701 for potential solutions. How it worksEach theme has a background and 1 layer. Any components placed directing on the background color uses the components from its own theme. Once you use a layer component (ie card, tile) the components that go on top of that layer would use an inline theme.
ZonesThe page is divided into "zones" and has a theme assigned to it. Nested ZoneWhile some zones are easily sectioned from top to bottom of the page like in the above example, sometimes the zones are stacked on the z coordinated creating layering within a page section. Consequences:
Questions:
|
Beta Was this translation helpful? Give feedback.
-
Such a good write-up! Thanks for taking the time to put this together @aagonzales My initial reaction is to go down the proposal 2 route, I think it has a couple of advantages for authoring components that are nice. The biggest of which is that a component does not need to be aware of what part of a layout it will be rendered in. It "just works". In proposal 1, I think from the component authoring perspective it could get annoying to support your component potentially rendering in any of the three layers and authoring it to work that way. (Or at least based on how I understand it, let me know if I'm misunderstanding) |
Beta Was this translation helpful? Give feedback.
-
Proposal 2 is how I naively expected the theming to work when I started using v10 😅 I was surprised to find that input backgrounds were not context aware on modals, etc. I also think the redlines are much easier to understand. I imagine a developer receiving a layering set redline like the "Product example" you included and them scratching their head a bit initially. Meanwhile the zones example redline is clear as day when you understand the components inside to be context aware. |
Beta Was this translation helpful? Give feedback.
-
Proposal 2 fits my existing mental model perfectly. |
Beta Was this translation helpful? Give feedback.
-
I like the inline theming, because this is the way I think about it when designing. Therefore it would be easier for me to continuing communicating to others (dev or design teams) in this way :) Also for proposal 1, the term "backgrounds" does actually resonate with me more than the term "layers" |
Beta Was this translation helpful? Give feedback.
-
I'm probably the only one voting for Proposal 01, but let me explain why I think it's the better approach:
|
Beta Was this translation helpful? Give feedback.
-
Really good write-up! Thank you, @aagonzales! I believe that a theme should be standalone for two main reasons:
@joshblack brings up a big pain point in his response (#7743 (comment)): specifying new components. Though, the simplicity mentioned there (creating the component with one set of tokens and it works across) could also be achieved with a middle-ground. Over in #7701 I explored this initially. What if a designer only specifies their component's colors with non-hierarchical tokens:
This would apply the no.1 rule of designing with carbon to color application:
Inline theming should still be possible to achieve what @joshblack called the "inverse" theme (#7743 (reply in thread)). For example to have a dark ui shell on a light app or a high contrast moment inside the content. Due to the propagation of css custom properties, all layering logic described above would still work with this. In summary, this feels like a combination of the two proposals:
Let me know if I misunderstood some parts of the proposal and if this makes sense! |
Beta Was this translation helpful? Give feedback.
-
Is there really only 1 dark theme?
|
Beta Was this translation helpful? Give feedback.
-
Hey @aagonzales and IBM team. I would like to thank you for this discussion.
@aagonzales @joshblack @yumeforever @mariuszmickiewicz |
Beta Was this translation helpful? Give feedback.
-
Background
Layering color logic
The mental model of how backgrounds layer or stack differs between the light themes (White and Gray 10) and dark themes (Gray 90 and Gray 100).
White
andGray10
when layering.Gray100
>Gray90
>Gray80
.Existing problems
No accounting for 3rd+ layer
The existing token structure doesn't account for the adding components onto this third layer.
In Carbon v10 we use a
light
prop to help with layering components on different ui colors. However, this solutions begins to fail in the dark themes once you get to the third layer The default variant usefield-01
and the light variant usefield-02
Token names aren't helpful enough in applying color
While our tokens help define what element a color should be applied to, the token name doesn't help much with understanding when or which token within a category to use.
Proposed solutions
Beta Was this translation helpful? Give feedback.
All reactions