-
-
Notifications
You must be signed in to change notification settings - Fork 78.9k
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
v5: Update colors to add shades and tints #29348
Conversation
This comment has been minimized.
This comment has been minimized.
Depending on how complicated you want it to be, you could go for material's palette and theming approach:
Trough some heavy lifting, at the end, there is a "theme" palette that consists of primary, secondary sub palettes (containing base, darker, lighter and contrast colors), complimentary sub palette (colors for text, body / application background etc) and a White the approach is definitely not for everyone, it actually makes sense to have a "source of truth" palette which you query, when you need a theme color. Of course, should one want to deviate, the rest of the colors are there. Or to put in some sort of code: // Not exactcly code
@function make-palette($base, $darker: null, $ligther: null, $contrast-values: () ) {
// if darker is not provided use shade($base) --> less way shade
// if ligther is not provided use tint($base) --> less way tint
// if contrast-values are not provided use contrast function
// some code
@return ( $default, $darker, $lighter, $default-contrast, $darker-contrast, $lighter-contrast);
}
// some transformations ...
$theme: (
"primary": (
default: ... , // use for, say link text color or button background color
darker: ... , // use for, say link hover text color or button hover background color
lighter: ... ,
default-contrast: ... , // use for, say button text color
darker-contrast: ... , // use for, say button hover text color
lighter-contrast: ...
),
"secondary": (
default: ... , // use for, say secondary button background color
darker: ... , // use for, say secondary button hover background color
lighter: ... ,
default-contrast: ... , // use for, say secondary button text color
darker-contrast: ... , // use for, say secondary button hover text color
lighter-contrast: ...
),
"complimentary": (
body-bg: ... ,
body-text: ... ,
component-bg: ... ,
component-text: ...
// more variables probably
)
); If you are trying to create a theme style guide, using the palette would be quite efficient. In addition, having the ability to manually specify colors for the theme palette makes it possible to fulfill designers request, because some times plain white and plain black are not what they want for contrasting color. |
@mdo, how are you going to address projects that already have tint and shade defined and use it in the less way? Per se, we already have them defined and we use the less way. Many of our customers use our product in conjuction with bootstrap. So what would happen should they include both ours and bootstrap's functions? |
I could see why we could add this, however I think a lot of developers will use Sass' built-in I'm not 100% against this, but I wanna make sure we don't add too much we don't use ourselves. |
Just pushed a few updates—sorry for the confusion, folks. I've fixed the language used for all the tints and shades: See this CodePen example for how each function generates different outputs. I've added details around this to the documentation so that folks understand the reasons for our custom functions. Can probably make some more improvements here, but this should definitely help explain some key details around our color system. Some additional reading and resources I found: |
LGTM now, the only thing left to tackle is finding a way to bypass fusv. Probably we'll need to implement something like |
BTW this needs a rebase and cleanup of the patches. As for fusv, PRs welcome as usual :) |
ce98161
to
9c9df04
Compare
I cleaned up the branch, fixed tests and used a range.
EDIT: nvm this doesn't work. |
01ddc4e
to
1e4cd74
Compare
* Add variables for shades and tints of each major color * getting-started/theming.md: use a `range`.
Not applicable anymore since #29348
Not applicable anymore since #29348
Not applicable anymore since twbs#29348
Fresh pass at this to replace #28268. This PR is entirely aimed at providing additional variables, and not any more classes (save for perhaps light
background-color
s andcolor
s in another PR). I truly wish we could generate the variables another way, but for now, this is a huge boost to customizability purely by color.shade
(lighten) andtint
(darken) each color./cc @twbs/css-review
Preview: https://deploy-preview-29348--twbs-bootstrap.netlify.com/docs/4.3/getting-started/theming/#all-colors