beamui
beamui copied to clipboard
How to change background color for Button and other ui elements ?
I used background-color to change color for Button. but its not working. How ti change background color and other "visual properties" for UI elements ?
Hi. This is because background-image
is also set to a gradient. Just set it to none
. It might not remove backgrounds in pressed state, but you can fix it by using a more powerful selector.
See common (this is SASS actually) and default styles for examples and to know, what is already set.
And how to make this from onClick event ?
Well, you need to change state. Then, using this state, you either:
- set an attribute, see
basic
example - or use inline styles:
InlineStyle style;
style.backgroundColor = color;
b.style = style;
Use the first approach if it covers your needs. It gives hot reload, better syntax, better performance, etc. The second method is for dynamically changing values.