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

Parameter "system-variables-prefix" is not used by "mat.system-level-colors" mixin #29504

Closed
1 task
slaviki opened this issue Jul 29, 2024 · 1 comment · Fixed by #29513
Closed
1 task

Parameter "system-variables-prefix" is not used by "mat.system-level-colors" mixin #29504

slaviki opened this issue Jul 29, 2024 · 1 comment · Fixed by #29513
Assignees
Labels
area: theming P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@slaviki
Copy link

slaviki commented Jul 29, 2024

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When the parameter "system-variables-prefix" is used, the custom variables generated by "mat.system-level-colors" still have the "--sys" prefix

Reproduction

StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-u6bo3u?file=src%2Fm3-theme.scss
Steps to reproduce:

  1. Create a new Angular project with Angular Material ~18.1.0
  2. Run "ng generate @angular/material:m3-theme" with any color value
  3. In the generated file "m3-theme.scss" in the bottom add "system-variables-prefix: test" to both color and typography:
$light-theme: mat.define-theme((
  color: (
    theme-type: light,
    primary: $_primary,
    tertiary: $_tertiary,
    use-system-variables: true,
    system-variables-prefix: test
  ),
  typography: (
    use-system-variables: true,
    system-variables-prefix: test
  ),
));
  1. Include the generated theme into your styles file
@use '@angular/material' as mat;
@use './m3-theme.scss' as my-theme;

@include mat.core();

html {
  // Apply the light theme by default
  @include mat.core-theme(my-theme.$light-theme);
  @include mat.button-theme(my-theme.$light-theme);

  // When using system variables, remember to provide values for them
  // or uncomment the lines below to generate them from the theme.
  @include mat.system-level-colors(my-theme.$light-theme);
  @include mat.system-level-typography(my-theme.$light-theme);
}
  1. Run the project and inspect "html" tag. You will see that the component's variables have the "--test" prefix, but the variables itself still have the "--sys" prefix
    image

Expected Behavior

Generated custom variables should have the prefix provided in the "system-variables-prefix" parameter both for colors and typography

Actual Behavior

Generated custom variables always have the "--sys" prefix, even if the "system-variables-prefix" parameter is provided

Environment

  • Angular: 18.1.0
  • CDK/Material: 18.1.2
  • Browser(s): Chrome 126
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 11
@slaviki slaviki added the needs triage This issue needs to be triaged by the team label Jul 29, 2024
@amysorto amysorto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent area: theming and removed needs triage This issue needs to be triaged by the team labels Jul 29, 2024
@crisbeto crisbeto self-assigned this Jul 30, 2024
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 30, 2024
…ome mixins

Fixes that the `system-level-colors` and `system-level-typography` mixins weren't using the `system-variables-prefix` passed in by the user.

Note: a bit of a gotcha here is that we need to store two separate prefixes, because in theory the user can pass different prefixes into `color` and `typography`.

Fixes angular#29504.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 30, 2024
…ome mixins

Fixes that the `system-level-colors` and `system-level-typography` mixins weren't using the `system-variables-prefix` passed in by the user.

Note: a bit of a gotcha here is that we need to store two separate prefixes, because in theory the user can pass different prefixes into `color` and `typography`.

Fixes angular#29504.
crisbeto added a commit to crisbeto/material2 that referenced this issue Jul 30, 2024
…ome mixins

Fixes that the `system-level-colors` and `system-level-typography` mixins weren't using the `system-variables-prefix` passed in by the user.

Note: a bit of a gotcha here is that we need to store two separate prefixes, because in theory the user can pass different prefixes into `color` and `typography`.

Fixes angular#29504.
crisbeto added a commit that referenced this issue Jul 30, 2024
…ome mixins (#29513)

Fixes that the `system-level-colors` and `system-level-typography` mixins weren't using the `system-variables-prefix` passed in by the user.

Note: a bit of a gotcha here is that we need to store two separate prefixes, because in theory the user can pass different prefixes into `color` and `typography`.

Fixes #29504.
crisbeto added a commit that referenced this issue Jul 30, 2024
…ome mixins (#29513)

Fixes that the `system-level-colors` and `system-level-typography` mixins weren't using the `system-variables-prefix` passed in by the user.

Note: a bit of a gotcha here is that we need to store two separate prefixes, because in theory the user can pass different prefixes into `color` and `typography`.

Fixes #29504.

(cherry picked from commit 6d70114)
@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 Aug 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: theming P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants