Replies: 4 comments 7 replies
-
Working on a Drupal admin theme I've gotten a naming convention I like that addresses a lot of the issues I listed above. Things I think this solves for:
For color variables, I have loved the following convention:
In PF we currently have:
I would prefer:
|
Beta Was this translation helpful? Give feedback.
-
I would agree that for color variables especially, the current convention is too verbose:
I have opinions on Wes' proposals, but they're based on the ultimate intent of these variables. If these variables absolutely aren't subject to change ever, I can support the convention: And that's because of specific questions I have about the color names: How do we align the names we would use against the named colors?What is the value of I would then assume that If that is the case, then does this mean that I'm ok with this approach, so long as
This would guarantee predictability for new developers. They'll know the colorspace they're working in, the purpose of that final modifier, and that every color they encounter is a variation on a globally known and understood color. What if we want colors that aren't the W3C's named colors?I would suggest a slightly different convention for working with colors that aren't in the named color list. I'm definitely on board for the what about e.g.
Colors break into warm and cool, so two distinct name groups. By adding 'er' and 'est', each group gets six total hues: warm, warmer, warmest, cool, cooler, coolest. Once we add a By using the modifier lighter/darker,
TL;DRI definitely agree with Wes' points about a BEMish convention that's less verbose and gives the developer a predictable idea of what the result is. My only points are:
|
Beta Was this translation helpful? Give feedback.
-
A few things to consider:
|
Beta Was this translation helpful? Give feedback.
-
Wow, this is an amazing discussion. To add, we are definitely going to have way less CSS variables exposed as public APIs now that Shadow Parts are here. Instead of exposing very specific CSS properties we can rely on Shadow Parts to give the user control. For instance, changing background colors. // from
:root {
--rh-theme__button__icon__backgroundColor: pink;
}
// to
rh-button::part(button) {
background-color: pink;
} I've been slowly phasing out BEM from my components since I've been doing web components. To me it was one of those things that we needed before we had style encapsulation. But that's just my bias, so wanted to lay that out there. :) |
Beta Was this translation helpful? Give feedback.
-
So I don't want to be that guy, but I feel like PFE, PF, and what I've seen from hanging with @bennypowers and seeing work on this wonderful project have issues that create confusion.
General concerns:
What I see as issues with current PF4 & PFE variables:
The logic for color naming feels opaque, meaning I have a hard time guessing what hue/saturation/value I will get from looking at the color var name. Is it documented somewhere?
Need for delineating terms in the variable name.
kebab-case
it's hard to know what's a term, e.g. (made up example)rh-featured-font
. Does featured belong to therh
as inrh-featured
, or the font as infeatured-font
.--pf-global--palette--black-900
, isglobal
necessary? I haven't seen a place where it's not that?Other things folks want to contribute as issues we might be able to improve with our current naming systems?
I'm going to leave potential ideas/solutions to the discussion thread.
Beta Was this translation helpful? Give feedback.
All reactions