Skip to content
Discussion options

You must be logged in to vote

I noticed the css in .venv\Lib\site-packages\nicegui\elements\joystick.vue make the properties background-color\width\height of div in ui.joystick fixed.

<style scoped>
:scope > div {
  background-color: AliceBlue;
  width: 10em;
  height: 10em;
  position: relative;
}
</style>

Then you can use following code to achieve ui.joystick's dark mode by css.

from nicegui import ui

joystick = ui.joystick(color='red',size=50,mode='static').classes('w-96 h-96 bg-white-400 dark:bg-black-400')
ui.query(f'#c{joystick.id} > div').style('background-color:unset;width:100%;height:100%;')
ui.switch('Dark Mode',on_change=lambda e:ui.dark_mode(e.sender.value))

ui.run()


Replies: 5 comments 13 replies

Comment options

You must be logged in to vote
5 replies
@LarsEggimann
Comment options

@rodja
Comment options

@falkoschindler
Comment options

@python-and-novella
Comment options

@LarsEggimann
Comment options

Comment options

You must be logged in to vote
1 reply
@LarsEggimann
Comment options

Answer selected by LarsEggimann
Comment options

You must be logged in to vote
4 replies
@LarsEggimann
Comment options

@python-and-novella
Comment options

@falkoschindler
Comment options

@python-and-novella
Comment options

Comment options

You must be logged in to vote
2 replies
@python-and-novella
Comment options

@falkoschindler
Comment options

Comment options

You must be logged in to vote
1 reply
@LarsEggimann
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants