Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Theming and Styling views #39

Closed
victordiaz opened this issue Jul 4, 2020 · 1 comment
Closed

Draft: Theming and Styling views #39

victordiaz opened this issue Jul 4, 2020 · 1 comment
Labels

Comments

@victordiaz
Copy link
Owner

victordiaz commented Jul 4, 2020

This API is added now to style the widgets (you can try it out already).
Is there any property that is interesting to add?

Example:

// change the main script theme
ui.setTheme({
  background: '#000055',
  primary: '#FF0000',
  secondary: '#00FF00',
  textPrimary: '#FFFF00',
  animationOnViewAdd: true
})

// get the theme properties
console.log(ui.getTheme())

ui.addTitle(app.name)

var slider = ui.addSlider(0.1, 0.5, 0.8, 0.2).mode('drag').onChange(function (e) {
  console.log(e)
})

// get all the slider properties
console.log(slider.getProps())

// change individual properties of a widget
slider.props.slider = "#00FF00"

var btn = ui.addButton('Click me', 0.1, 0.2, 0.8, 0.2).onClick(function () {
  console.log('clicked')
})

// change many properties at once
btn.setProps({
  background : '#00bbbb',
  textSize: 50
})

Output:
photo_2020-07-04_20-06-07

@victordiaz
Copy link
Owner Author

This got quite nice in the last versions, so closing the question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant