rust_gui icon indicating copy to clipboard operation
rust_gui copied to clipboard

add styling support

Open enex opened this issue 10 years ago • 0 comments

for a ui framework it is neccessary to have styleing support. I plan to implement it simply by prviding default values for Widgets over the context.

components::Button{
    text: "OK",
    ..c.style("affirm")
}.draw(c, 1);

So every component can be styled individualy and also selectors like only style child-nodes aren't a problem. c.default() will just provide the style of the component in the current scope. If a property is not specified in the Stylesheet, the default for the component will be used.

The stylesheet itsselve could look like:

Button#affirm{
    bg_color: #232323

    Label{
        font_size: 18.
    }
}

This stylesheet could also be used to implement different languages by specifying the Text content.

enex avatar May 10 '15 17:05 enex