Skip to content

Commit

Permalink
update theme demo
Browse files Browse the repository at this point in the history
  • Loading branch information
wang0618 committed Nov 7, 2021
1 parent 057b227 commit 3c7c0c9
Showing 1 changed file with 25 additions and 21 deletions.
46 changes: 25 additions & 21 deletions demos/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ def main(): # PyWebIO application function
dict(label=i, value=i, color=i)
for i in ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark']
], onclick=lambda b: toast(f'Clicked {b} button'), outline=True)

put_buttons([
dict(label=i, value=i, color=i)
for i in ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark']
], onclick=lambda b: toast(f'Clicked {b} button'), group=True)
with put_scrollable(border=False, height=None):
put_buttons([
dict(label=i, value=i, color=i)
for i in ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark']
], onclick=lambda b: toast(f'Clicked {b} button'), group=True)
###########################################################################################
put_markdown('# Tables')
put_markdown("""
Expand Down Expand Up @@ -258,13 +258,14 @@ def show_popup():
put_markdown('# Loading')
put_processbar('processbar', 0.3)
put_text()
put_grid([
[
put_loading(shape=shape, color=color)
for color in ('primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark')
]
for shape in ('border', 'grow')
], cell_width='50px', cell_height='50px')
with put_scrollable(border=False, height=None):
put_grid([
[
put_loading(shape=shape, color=color)
for color in ('primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark')
]
for shape in ('border', 'grow')
], cell_width='50px', cell_height='50px')
###########################################################################################
put_markdown('# Tabs')

Expand Down Expand Up @@ -345,22 +346,25 @@ def page():
</div>
""")

put_markdown('# Switch Themes')
put_table(
[
[
put_image(f"https://cdn.jsdelivr.net/gh/wang0618/PyWebIO@dev/docs/assets/theme/{name}.png").onclick(
partial(go_app, name=name, new_window=False))
for name in ALL_THEME if name != theme],
]
)
put_markdown('# Switch Theme')
themes = [
put_image(f"https://cdn.jsdelivr.net/gh/wang0618/PyWebIO@dev/docs/assets/theme/{name}.png").onclick(
partial(go_app, name=name, new_window=False))
for name in ALL_THEME if name != theme
]
if info.user_agent.is_mobile:
put_table([themes[:2], themes[2:]])
else:
put_table([themes])

put_markdown("""
### Credits
The dark theme is modified from ForEvolve's [bootstrap-dark](https://github.com/ForEvolve/bootstrap-dark).
The sketchy, minty and yeti theme are from [bootswatch](https://bootswatch.com/4/).
""", lstrip=True)

set_env(input_panel_min_height=100, input_panel_init_height=190)
output_widgets()
pin_widgets()
form()
Expand Down

0 comments on commit 3c7c0c9

Please sign in to comment.