widgetti / widgetti/ipyvuetify
change theme background colour not working
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 355
- Forks
- 61
- PR merge metrics
- No merged PRs in 30d
Description
Following this example from https://stackoverflow.com/questions/65033675/how-to-switch-from-light-to-dark-theme-in-ipyvuetify
it doesn't change the coloou.
Is there any other way to do it?
Thanks
A trick is to add an opaque Overlay component as background (z-index=-1) and change its color upon switching the ipyvuetify theme:
import ipyvuetify as v
dark_bg = '#7FFF00'
light_bg = '#7FFF00'
bg = v.Overlay(
color=dark_bg if v.theme.dark==True else light_bg,
opacity=1,
style_='transition:unset',
z_index=-1
)
def bg_switch(widget, event, data):
v.theme.dark = not v.theme.dark
bg.color = dark_bg if v.theme.dark==True else light_bg
btn = v.Btn(children=[v.Icon(children=['mdi-theme-light-dark'])])
btn.on_event('click', bg_switch)
v.Container(children=[bg, btn])
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the linked Stack Overflow example in a Jupyter notebook, using the issue's v.theme, Overlay, and background-switch handler entry points. Inspect how ipyvuetify applies theme and Overlay colors, then verify that switching the theme visibly changes the page background without requiring an unsupported workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100