Is it possible to configure a custom color for the ionic toggle element?
Looking to change the color from the preset “green” to the below purple.
Using CSS Tools plugin? Or another way?
Is it possible to configure a custom color for the ionic toggle element?
Looking to change the color from the preset “green” to the below purple.
Using CSS Tools plugin? Or another way?
Yes, here’s the solution
Add this text to the page you want. This changes all ionic checkbox elements on the page (possibly the app?)
<style>
.ionic-toggle.toggle-positive input:checked + .ionic-track {
border-color: #208cb8;
background-color: #208cb8;
}
</style>
– Paul
I tried this with a direct copy/paste of your quoted code, no luck. Also tried it with !important:
<style>
.ionic-toggle.toggle-positive input:checked + .ionic-track {
border-color: #208cb8 !important;
background-color: #208cb8 !important;
}
</style>
Any idea why it’s not working for me? Does your code still work for you?
wrong class
Paste this one:
.ionic-toggle input:checked + .ionic-track { border-color: #c919cf !important; background-color: #c919cf !important; }That worked, thank you!
Yes, my code still works for me, but I’m glad there is another option that worked for you.