4

can someone tell me, how I can change the colour of the round circle when you click the angular material checkbox. Shown in the following image (the pink circle)

enter image description here

Here is the link from the official webpage: https://material.angular.io/components/checkbox/overview

Thanks for the Help

3
  • This round circle is called ripple. Do you want to change the color of only on the checkbox ripple or all the ripples in the app? Or do you want to disable the ripple altogether? Commented Jun 11, 2018 at 7:23
  • actually, I want to change all ripple effects in the app. the earlier post helped me with changing the checkbox ripple .green-checkbox { .mat-ripple-element { background-color: $darkgreen !important; opacity: 0.5; } } i dont know, why its been deleted Commented Jun 11, 2018 at 8:10
  • 1
    @Peter I deleted my post because for some reason it was being downvoted. If it helped you, I will undelete it. Commented Jun 11, 2018 at 8:13

1 Answer 1

8

The checkbox (both the checkmark and the ripple), by default uses the accent color from your theme. You can change it to use the primary color by using the color = "primary" property on the element. If you want to use a custom color (i.e. not from the theme), you'd have to override the CSS manually or create a custom theme.

If you only want to override the color of the ripple, you can override the .mat-ripple-element class which is added on the generated ripple element whenever you click the checkbox. Add your desired styles to theme.scss.

.custom-ripple {
  .mat-ripple-element {
    background-color: rgba(100, 200, 50, 0.5) !important;
  }
}

Here's an example.

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.