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.

[button] toggle button with a different background-color

See original GitHub issue

Feature Request

AFAICT, .ui.toggle.button.active uses background-color: @positiveColor;

Would it be possible to choose a custom background-color?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
bartocccommented, Jul 16, 2020

I should have been more precise in my question. The idea I had in mind was to be able to do so without theming, but with predifined CSS classes.

Something like this or similar: <button class="ui toggle toggle-red button">my button</button>

this way, you could render 2 toggle buttons side by side with different background colors when active

1reaction
lubber-decommented, Jul 16, 2020

Here is another workaround without extra css. Replace the classname active by the desired color name

$('.ui.toggle.button')
    .state({
      className: {
        active   : 'purple'
      }
})

simpletoggle

See https://jsfiddle.net/lubber/vL4he5fd/15/

Read more comments on GitHub >

github_iconTop Results From Across the Web

Toggle button background color when clicked - Stack Overflow
1 - The button starts out with this color unClickedColor = #0f2e0c . However, on the very first click, the alert does not...
Read more >
Toggle an Element's background color on click using JS
Toggle an Element's background color on click using JS #. To toggle an element's background color on click: Add a click event listener...
Read more >
How to change the “checked” background color of toggle ...
In Bootstrap 4, the background color of the toggle switch is blue. This color can be changed by manipulating the custom-control-input class.
Read more >
Switch Background Color On Toggle Click [CSS + JavaScript]
Switch Background Color On Toggle Click [CSS + JavaScript] | How To Change Background Color On Button Click | JavaScript Background ...
Read more >
3 Ways To Toggle A Button On Click In Vue JS - SoftAuthor
At this stage, toggling the active class to the button will change the background color from grey to green and vice versa.
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