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

feat(theming): Provide an easy way to configure foreground and background palette #22714

Closed
anschm opened this issue May 18, 2021 · 2 comments
Closed
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix needs triage This issue needs to be triaged by the team

Comments

@anschm
Copy link

anschm commented May 18, 2021

Feature Description

It would be really cool to have an easy way to configure the foreground and background palette and pass them into the theming like:

$my-light-theme-foreground-palette: (
base: black,
divider: $my-dark-dividers,
dividers: $my-dark-dividers,
disabled: $my-dark-disabled-text,
disabled-button: rgba(black, 0.26),
disabled-text: $my-dark-disabled-text,
elevation: black,
hint-text: $my-dark-disabled-text,
secondary-text: $my-dark-secondary-text,
icon: rgba(black, 0.54),
icons: rgba(black, 0.54),
text: rgba(black, 0.87),
slider-min: rgba(black, 0.87),
slider-off: rgba(black, 0.26),
slider-off-active: rgba(black, 0.38),
);

$my-light-theme-background-palette: (
status-bar: map-get(mat.$grey-palette, 300),
app-bar: map-get(mat.$grey-palette, 100),
background: map-get(mat.$grey-palette, 50),
hover: rgba(black, 0.04),
card: white,
dialog: white,
disabled-button: rgba(black, 0.12),
raised-button: white,
focused-button: $my-dark-focused,
selected-button: map-get(mat.$grey-palette, 300),
selected-disabled-button: map-get(mat.$grey-palette, 400),
disabled-button-toggle: map-get(mat.$grey-palette, 200),
unselected-chip: map-get(mat.$grey-palette, 300),
disabled-list-option: map-get(mat.$grey-palette, 200),
tooltip: map-get(mat.$grey-palette, 700),
);

$light-theme: mat.define-light-theme(
$primary-palette,
$accent-palette,
$warn-palette,
$my-light-theme-foreground-palette,
$my-light-theme-background-palette
);

Actually I have to override the properties of the theme after creating them, like:

$light-theme: mat.define-light-theme(
$primary-palette,
$accent-palette,
$warn-palette
);
$light-theme: map_merge($light-theme, (background: $my-light-theme-background-palette));
$light-theme: map_merge($light-theme, (foreground: $my-light-theme-foreground-palette));

This seems a little bit ugly to me. I think it would be cleaner to pass the background and foreground palettes into the define-light-theme and define-dark-theme methods.

@anschm anschm added feature This issue represents a new feature or feature request rather than a bug or bug fix needs triage This issue needs to be triaged by the team labels May 18, 2021
@jelbourn
Copy link
Member

Duplicate of #6244

@jelbourn jelbourn marked this as a duplicate of #6244 May 19, 2021
@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 Jun 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature This issue represents a new feature or feature request rather than a bug or bug fix needs triage This issue needs to be triaged by the team
Projects
None yet
Development

No branches or pull requests

2 participants