I want to change the button color of a ipywidget ToggleButton. In the docs it is described as:
widgets.ToggleButtons(
options=['Slow', 'Regular', 'Fast'],
description='Speed:',
disabled=False,
button_style='', # 'success', 'info', 'warning', 'danger' or ''
tooltips=['Description of slow', 'Description of regular', 'Description of fast'],
# icons=['check'] * 3
)
The only way I can see is with button_style, which however has just the predefined options seen in the code. Is there a way to define such a preset on your own with custom button colors? I also tried styling it with CSS. button_color, description_color as well as background_color all did not work.
I cannot change the toggle button color to any other than the predefined color schemes ('success', 'info', 'warning', 'danger' or ''). Also jumping into the package, I did not find where they are defined. That is why I am not able to overwrite them.
Also, I am working in a Jupyter Notebook.
Kind regards, Timo
Widgets have a style attribute which might help you achieve what you want, read more here:
https://ipywidgets.readthedocs.io/en/latest/examples/Widget%20Styling.html#The-style-attribute
The attributes will vary by widget type. Unfortunately the keys option for ToggleButtons does not list button_color, so it does not look like the color can be modified this way.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With