Skip to content

mat-slide-toggle styling inconsistent #14192

@arciisine

Description

@arciisine

Bug, feature request, or proposal:

As of #12698, changes were made to slide toggle styling to support the theme properly.

The issue is, that in the dark theme, the slide toggle styling relies on a key of 200 to be in the palette for coloring.
https://angular-kh6bg8.stackblitz.io

As far as I can tell, this is the only location that makes this choice. Everywhere else is dependent upon default, lighter, or darker.

What is the expected behavior?

That the slide toggle would rely upon default/lighter/darker for the checked state, in the dark theme.

What is the current behavior?

The slide toggle relies upon the palette's 200 value for the checked state in the dark theme.

Below is the current input I have to construct for mat-pallete to allow sass to compile

$mat-primary: (
  main: #cc33ca,
  lighter: #f0c2ef,
  darker: #b920b7,
  200: #cc33ca, // For slide toggle,
  contrast : (
    main: $light-primary-text,
    lighter: $dark-primary-text,
    darker: $light-primary-text,
  )
);
$theme-primary: mat-palette($mat-primary, main, lighter, darker);

$theme: mat-dark-theme($theme-primary, ... );

What are the steps to reproduce?

https://angular-kh6bg8.stackblitz.io

What is the use-case or motivation for changing an existing behavior?

That by default, when defining a theme, the only colors that are needed are lighter, darker, and default. There should not a need to define all the other colors in a custom theme.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Material, latest

Is there anything else we should know?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions