Skip to content

icon color is lost after click #5408

Answered by asyncLiz
tve asked this question in Q&A
Discussion options

You must be logged in to vote

There are often "stateful" color tokens like hover, focus, and pressed that may need to be set for a component. See Why does my color change on hover/focus/pressed? in our FAQ for details.

For icon button's tokens, that'd be the following:

md-icon-button.orange {
  --md-icon-button-icon-color: orange;
  --md-icon-button-hover-icon-color: orange;
  --md-icon-button-focus-icon-color: orange;
  --md-icon-button-pressed-icon-color: orange;
}

This gets to be a lot when they're all the same color. We mention in How do I change the color of a button? that you can also set the system color all of the stateful tokens map to.

For icon button, that's on-surface-variant.

md-icon-button.orange {
  --m…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tve
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants