4

Is it possible to change the color of the checkbox using the material theme? For example, with a normal you can simply do <mat-checkbox color="primary">. However something like <mat-list-option color="primary"> does not seem to have any effect.

I couldn't find anything about this in the Angular Material API reference but surely there's a way besides changing the color manually (i.e. not using the theme) like in this question?

2
  • 1
    MatListOption doesn't use the color option. So the only way to change color is 'manually'. Commented Sep 6, 2018 at 21:27
  • This component is really not mature, not only it doesn't play nice with angular theming system, but also it does not offer any state indicator (like .mat-checkbox-checked or .mat-radio-checked) at the option level. This make it really hard to style, if you can use mat-radio or mat-checkbox instead pass your way. Commented Jan 18, 2019 at 15:01

1 Answer 1

3

Check this StackBlitz: Custom option list

Add this to your style.css file:

.mat-pseudo-checkbox::after {
    color: red;
}

.mat-pseudo-checkbox {
    background: lightblue;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.