Reputation: 2708
The documentation explains the basic colors you can set on the button.
widgets.Button(
description='Click me',
disabled=False,
button_style='', # 'success', 'info', 'warning', 'danger' or ''
tooltip='Click me',
icon='check'
)
Are there additional colors that can be used? How?
Upvotes: 1
Views: 5012
Reputation: 2708
Documentation explains that widgets have a style attribute that has different properties depending on the widget type.
In our case
import ipywidgets as widgets
b=widgets.Button(description=button_style, button_style='')
b.style.keys
['_model_module',
'_model_module_version',
'_model_name',
'_view_count',
'_view_module',
'_view_module_version',
'_view_name',
'button_color',
'font_weight']
So, apart from the basic colors
import ipywidgets as widgets
for button_style in ['primary','success', 'info', 'warning', 'danger' , '']:
print(button_style)
widgets.Button(description=button_style, button_style=button_style)
You can have any of the html colors
name_colors="GreenYellow Chartreuse LawnGreen Lime LimeGreen".split()
for button_color in name_colors:
print(button_color)
b=widgets.Button(description=button_style, button_style='')
b.style.button_color = button_color
b
This may be needed in your case to display multiple outputs
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
Upvotes: 2