-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Make it easier to have different colors per tenant #5021
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c4107fe
to
eb1d57d
Compare
2ea4dde
to
42caf03
Compare
eb1d57d
to
5a5d624
Compare
42caf03
to
9ac8ddb
Compare
5a5d624
to
b541ecd
Compare
51da408
to
7f99331
Compare
634ed63
to
551cfe9
Compare
2ffbf74
to
ea50395
Compare
551cfe9
to
cc543a5
Compare
4ca56a1
to
e38b860
Compare
44181d8
to
d6b76b1
Compare
Until now, we didn't have specific variables for the headers and were using the brand colors instead. Now we maintain the brand colors as default values, but allow overwriting them. For the navigation and footer, we didn't even have variables.
So now inverting the selection for brand-secondary backgrounds will depend on the value of brand-secondary.
We don't need the color parameter anymore since we can now use a more generic mixin for any background, like brand-secondary.
This is consistent with the `body-colors` mixin and with other mixins we're about to add, like `anchor-color`.
Until now, overwriting the styles for a certain tenant was a very tedious task. For example, if we wanted to use a different brand color for a tenant, we had to manually overwrite the styles for every element using that color. It isn't possible to use different SCSS variables per tenant unless we generate a different stylesheet per tenant. However, doing so would make the CSS compilation take way too long on installations with more than a couple of tenants, and it wouldn't allow to get the colors dynamically from the database, which we intend to support in the future. So we're using CSS variables instead. These variables are supported by 97% of the browsers (as of October 2022), and for the other 3% of the browsers we're using the default colors (SCSS variables) instead. CSS variables have some limitations: for instance, it isn't possible to use functions like `lighten`, `darken` or `scale-color` with CSS variables, so the application might behave in a strange way when we use these functions. It also isn't possible to automatically get whether black or white text makes a better contrast with a certain background color. To overcome this limitation, we're providing variables ending with `-contrast`. For instance, since the default `$brand` color is a dark one, when assigning a light color to `--brand`, we probably want to assign `--brand-contrast: #{$black}` as well, so the text is still readable.
Just like we did with SCSS variables, we use the `--main-header` CSS variable and, if it isn't defined, we use the `--brand` CSS variable instead. Note that we're still using the `inverted-selection` mixin based on the default `$main-header` color, so it's possible that we get the inverted selection in the main header when using a dark color with `$main-header` but a light color with `--main-header`, which doesn't make much sense. Not sure whether there's anything we can do about it.
Just like we did with SCSS variables, we use the --anchor-color CSS variable and, if it isn't defined, we use the --brand CSS variable instead.
We were already doing the same for the main header color; now we also make it easier to use different top links, subnavigation and footer colors per tenant. Just like we do with SCSS variables, we use the brand-secondary color for the top links when the `--top-links` variable isn't defined.
d6b76b1
to
ccbdfb8
Compare
taitus
approved these changes
Nov 21, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
References
Objectives
Notes
This code uses CSS variables, which means it will work on (as of October 2022) about 97% of the browsers. We're providing fallbacks so the other 3% of the browsers see the default colors instead. For single-tenant applications, we recommend using SCSS variables instead, which will work on 100% of the browsers and will allow using SCSS functions like
lighten
ordarken
.With this pull request, the main header, top links, subnavigation, footer, links and brand/button colors can be customized using CSS variables.