Skip to content

Allow CSS variables in color palettes #15107

Closed
@StefanKern

Description

@StefanKern

Please describe the feature you would like to request.

A color palette has to be defined by by using COLOR values, but doesn't allow CSS variables.

Example:

$sample-palette: (
  50 : var(--color-primary), ...

is invalid.

What is the use-case or motivation for this proposal?

We have an application, where we defined the colors as CSS variables, so we can switch for different brands.

Is there anything else we should know?

Only two places are depending on the colors:

  .mat-calendar-body-disabled > .mat-calendar-body-selected {
    background-color: fade-out(mat-color($palette), $mat-datepicker-selected-fade-amount);
  }

_theming.scss 2542

.mat-calendar-body-disabled > .mat-calendar-body-today:not(.mat-calendar-body-selected) {
    border-color: fade-out(mat-color($foreground, hint-text), $mat-datepicker-today-fade-amount);
  }

_theming.scss 2603

If these lines are commented out, a palette can be used with CSS variables.

I know CSS variables are not supported by Internet explorer. However just changing these two lines (the calendar disables state), would allow their usage!

Metadata

Metadata

Labels

P2The issue is important to a large percentage of users, with a workaround

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions