question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

theming: deprecate and remove legacy theme color generation

See original GitHub issue

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

Don’t know if it’s intended behavior or not. Scss generated by mat.define-dark-theme or mat.define-light-theme have duplicated keys/values/styles.

Notice the duplicated values for:

  • primary
  • accent
  • warn
  • is-dark
  • foreground
  • background

Reproduction

Steps to reproduce:

  1. Create new project ng new 1.1 Choose SCSS as stylesheet
  2. Add angular material ng add @angular/material 2.1 For prebuild theme, choose custom option
  3. In styles.scss file, add @debug $name-of-app-theme image

Expected Behavior

Should exist only one definition for

  • primary
  • accent
  • warn
  • is-dark
  • foreground
  • background

Actual Behavior

Below I attached the result of @debug . Take a look at primary color, for example and notice the value is repeated for no reason. The only difference is the parenthesis before.

debug.txt

Environment

  • Angular: 13.0.1
  • CDK/Material: 13.0.0
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
devversioncommented, Nov 18, 2021

This is actually an intentional duplication to ensure backwards compatibility since we changed some of the internals of the theming API in preparation for density with MDC etc.

We should mark this old pattern as deprecated in an upcoming minor and remove this in the future. Here is the related code:

https://github.com/angular/components/blob/df7c46b82a7ecdfe74aad136e0c880e5631c7b7b/src/material/core/theming/_theming.scss#L388-L411

0reactions
crisbetocommented, Jul 12, 2022

I don’t think that we’ve announced anywhere that the .import files are deprecated, but we haven’t been exposing any new APIs through them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deprecated and obsolete modules and themes - Drupal
The Color module has been deprecated in Drupal 9.4 and will be removed from Drupal 10.0. In most cases, you will only need...
Read more >
Angular Material Theming System - Complete Guide
In Angular Material, a theme is a collection of color and typography options. Each theme includes three palettes that determine component colors: primary ......
Read more >
Migrating to Material Design 3
Learn how to migrate to our newest updates.
Read more >
Theme Support | Block Editor Handbook
By default, the color palette offered to blocks allows the user to select a custom color different from the editor or theme default...
Read more >
prefers-color-scheme - CSS: Cascading Style Sheets | MDN
The prefers-color-scheme CSS media feature is used to detect if a user has requested light or dark color themes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found