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.

Ability to set more than just primary 500, accent 500 or warn 500 as button colors

See original GitHub issue

Bug, feature request, or proposal:

Feature request

What is the expected behavior?

It would be nice to be able to specify a color level from a specified palette to a button using the color attribute. I sometimes want to be able to make a FAB primary 400 or something like that

What is the current behavior?

You can set a button to primary, accent, or warn and the button component picks the 500 level of that palette

What are the steps to reproduce?

Providing a Plunker (or similar) is the best way to get the team to see your issue. Plunker template: https://goo.gl/DlHd6U

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

We don’t always want to use the 500 level of our palettes for styling buttons or other components

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

Angular material beta 8

Is there anything else we should know?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:14
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
bradringelcommented, Jul 26, 2017

Interesting, didn’t know that it only used the default. I’m not sure that would solve this issue though because I do want most of the components to be styled using 500, but it would be nice to choose another color for one or two things in certain situations. Currently I’m just overriding the color by defining a style for .mat-fab.mat-primary in the component where the fab is used and setting the color there. That will probably break at some point either due to selector name changes or shadow DOM stuff

1reaction
willshowellcommented, Jul 28, 2017

@bradringel I don’t know why this didn’t occur to me before:

You can create two themes (see the part about multiple themes), like $my-main-theme, and $my-secondary-theme. In the secondary one, use alternate palette colors (like indigo-400 for primary).

Then just wrap your FAB or whatever with that class

.my-secondary-theme {
  @include angular-material-theme($my-secondary-theme);
}
<div class="my-secondary-theme"><button md-fab>...</button></div>
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use custom material color palettes in Angular?
Angular Material themes are based on defining your primary , warn and accent colors. The Documentation on Angular Material Theming are very ...
Read more >
Palette - Material UI - MUI
The palette enables you to modify the color of the components to suit your brand. ... It provides more ways to accent and...
Read more >
Customizing Colors - Tailwind CSS
Customizing the default color palette for your project. Default color palette. Tailwind includes an expertly-crafted default color palette out-of-the-box that ...
Read more >
Colors - Bootstrap
Colors. Convey meaning through color with a handful of color utility classes. Includes support for styling links with hover states, too.
Read more >
Custom theming in Angular Material - mobilemotion.eu
Angular Material decides which one to display for what part of a user control, the default value is always the shade marked as...
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