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.
16 lines
615 B
SCSS
16 lines
615 B
SCSS
// If you're using multitenancy, you can override styles for a certain
|
|
// tenant by styling the `<html>` element with the class
|
|
// `tenant-<tenant_name>`. For example, to style the public (main)
|
|
// tenant without these styles affecting any other tenants, use the
|
|
// `.tenant-public` selector.
|
|
//
|
|
// You can use CSS variables to customize the colors. Here's an example
|
|
// changing the brand color for just the main tenant.
|
|
//
|
|
// .tenant-public {
|
|
// --brand: #351;
|
|
// }
|
|
//
|
|
// NOTE: If you are **not** using mulitenancy, we recommend overwriting
|
|
// SCSS variables in the `_consul_custom_overrides.scss` file instead
|