Skip to content
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

Allow CSS variables in color palettes #15107

Closed
StefanKern opened this issue Feb 7, 2019 · 2 comments · Fixed by #15140
Closed

Allow CSS variables in color palettes #15107

StefanKern opened this issue Feb 7, 2019 · 2 comments · Fixed by #15140
Assignees
Labels
P2 The issue is important to a large percentage of users, with a workaround

Comments

@StefanKern
Copy link

StefanKern commented Feb 7, 2019

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!

@jelbourn jelbourn added the P2 The issue is important to a large percentage of users, with a workaround label Feb 7, 2019
@jelbourn
Copy link
Member

jelbourn commented Feb 7, 2019

@mmalerba we should remove this use of fade-out from the calendar CSS

@crisbeto we should have something that asserts that people can successfully use css variables like this

crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 10, 2019
* Adds an extra theme to the build that will allow us to verify that everything still works if somebody passes in the palette colors as CSS variables.
* Fixes a handful of places where Sass would either throw an error or would produce invalid CSS.

Fixes angular#15107.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 10, 2019
* Adds an extra theme to the build that will allow us to verify that everything still works if somebody passes in the palette colors as CSS variables.
* Fixes a handful of places where Sass would either throw an error or would produce invalid CSS.

Fixes angular#15107.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 10, 2019
* Adds an extra theme to the build that will allow us to verify that everything still works if somebody passes in the palette colors as CSS variables.
* Fixes a handful of places where Sass would either throw an error or would produce invalid CSS.

Fixes angular#15107.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 10, 2019
* Adds an extra theme to the build that will allow us to verify that everything still works if somebody passes in the palette colors as CSS variables.
* Fixes a handful of places where Sass would either throw an error or would produce invalid CSS.

Fixes angular#15107.
crisbeto added a commit to crisbeto/material2 that referenced this issue Feb 11, 2019
* Adds an extra theme to the build that will allow us to verify that everything still works if somebody passes in the palette colors as CSS variables.
* Fixes a handful of places where Sass would either throw an error or would produce invalid CSS.

Fixes angular#15107.
jelbourn pushed a commit that referenced this issue Feb 13, 2019
* Adds an extra theme to the build that will allow us to verify that everything still works if somebody passes in the palette colors as CSS variables.
* Fixes a handful of places where Sass would either throw an error or would produce invalid CSS.

Fixes #15107.
jelbourn pushed a commit that referenced this issue Feb 20, 2019
* Adds an extra theme to the build that will allow us to verify that everything still works if somebody passes in the palette colors as CSS variables.
* Fixes a handful of places where Sass would either throw an error or would produce invalid CSS.

Fixes #15107.
@Splaktar Splaktar changed the title Allow CSS variables in color paletts Allow CSS variables in color palettes Mar 15, 2019
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants