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

Styling #60

Open
1 task
Juuxel opened this issue Jun 11, 2020 · 0 comments
Open
1 task

Styling #60

Juuxel opened this issue Jun 11, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@Juuxel
Copy link
Member

Juuxel commented Jun 11, 2020

Current plan:

  • JSON5-based (like Spinnery), since CSS is too heavy and there is an existing JSON5 parser bundled with LibGui (Jankson)
  • CSS-like selectors
  • Widgets can have a CSS-like style class, ID and a hierarchy of types (grid <- panel or just button for example)

Example of a style:

{
  button: {
    // Applies to all buttons
    text_color: 0xFF0000
  },
  "button.run_button, label": {
    // Buttons with the class .run_button and all labels
    background_color: 0xFF0000FF
  }
}

All styles are stored as assets/<namespace>/libgui/stylesheet.json5 (replace libgui with the project name if this is moved to another project). They are loaded and stacked from all resource packs.

TODO:

  • For selecting things with classes, there needs to be some sort of a priority system for selectors (I'm thinking of widget ID > numbers of classes > index in type hierarchy as a simple priority system)
@Juuxel Juuxel added the enhancement New feature or request label Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant