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

schematic(theme): inject a palette definition for customization #16417

Open
Splaktar opened this issue Jul 1, 2019 · 1 comment
Open

schematic(theme): inject a palette definition for customization #16417

Splaktar opened this issue Jul 1, 2019 · 1 comment
Labels
area: ng-generate Schematics that generate code in user projects feature This issue represents a new feature or feature request rather than a bug or bug fix P4 A relatively minor issue that is not relevant to core functions

Comments

@Splaktar
Copy link
Member

Splaktar commented Jul 1, 2019

Feature Description

Currently, users need to dig into node_modules/@angular/material/_theming.scss and find a palette like $mat-blue and then manually copy that into their styles.scss and modify it in order to create a custom palette.

This used to be easier in AngularJS Material where you could just extend an existing theme and make minor modifications.

Use Case

  1. The most common case that I have seen is that developers want to tweak the contrast colors of a specific theme.
  2. However, it is also common to need to change just 1 or 2 colors, in an existing palette, slightly to match company branding.
  3. In some cases, there is a need to create a completely custom palette, or set of palettes, for use in an application with highly custom theming.

Proposal

ng g @angular/material:palette --base=mat-blue --path=src/styles.scss my-blue

This would inject the following into src/styles.scss immediately after @include mat-core();:

$my-blue: (
  50: #e3f2fd,
  100: #bbdefb,
  200: #90caf9,
  300: #64b5f6,
  400: #42a5f5,
  500: #2196f3,
  600: #1e88e5,
  700: #1976d2,
  800: #1565c0,
  900: #0d47a1,
  A100: #82b1ff,
  A200: #448aff,
  A400: #2979ff,
  A700: #2962ff,
  contrast: (
    50: $dark-primary-text,
    100: $dark-primary-text,
    200: $dark-primary-text,
    300: $dark-primary-text,
    400: $dark-primary-text,
    500: $light-primary-text,
    600: $light-primary-text,
    700: $light-primary-text,
    800: $light-primary-text,
    900: $light-primary-text,
    A100: $dark-primary-text,
    A200: $light-primary-text,
    A400: $light-primary-text,
    A700: $light-primary-text,
  )
);

It would still be up to the developer to actually use the palette in defining a theme (i.e. $app-primary: mat-palette($my-blue);).

Relates to #16416.
Related Custom theming Docs.

@Splaktar Splaktar added the feature This issue represents a new feature or feature request rather than a bug or bug fix label Jul 1, 2019
@mmalerba mmalerba added the needs triage This issue needs to be triaged by the team label May 20, 2020
@devversion
Copy link
Member

I think this might be also related to #13265

@devversion devversion added area: ng-generate Schematics that generate code in user projects P4 A relatively minor issue that is not relevant to core functions and removed needs triage This issue needs to be triaged by the team labels May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ng-generate Schematics that generate code in user projects feature This issue represents a new feature or feature request rather than a bug or bug fix P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

No branches or pull requests

3 participants