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

Support styling #12

Open
frmdstryr opened this issue Jul 6, 2022 · 3 comments
Open

Support styling #12

frmdstryr opened this issue Jul 6, 2022 · 3 comments

Comments

@frmdstryr
Copy link
Contributor

Are there any plans to support styles? Like background colors and the label font size.

@zenith391
Copy link
Member

Yes, although I'm still planning the architecture of how will it be done, like should it be something similar to CSS (albeit with the bad and confusing parts due to backward-compatibility replaced), and how to apply it to native widgets consistently on all platforms. But it's coming soon:tm:.

@Losiel
Copy link

Losiel commented Aug 10, 2022

(Sorry for replying to an old issue) but what about something like DataWrapper but StyleWrapper?

const importantButton = capy.StyleWrapper(
  .{
     .backgroundColor = capy.rgb(255, 0, 0)
   }
)

and then for creating a button let's say

.button(.{.label = "DELETE YOUR ENTIRE OS"}).style(importantButton)

(maybe not limit buttons to only one style?. styles added first have less priority)
and if you do something like importantButton.backgroundColor.blue = 255 will update every component using the style. or even let styles use DataWrappers, but maybe that's too complex

This is just an idea I had and I don't know how cross platform would that be. However I think it's better than something like CSS because you don't have to parse and that would help linters (?)

@mgord9518
Copy link

@zenith391 it should be possible to style a button using a bitmap for pretty much any conceivable UI kit, although it may have performance implications.

Maybe the theme engine could support basic drawing like lines, fill, alignment and gradients, then anything that somehow doesn't support drawing them on the fly could fall back on a pre-rendered bitmap? If this route is chosen, then a TinyVG (Zig-native vector image) Kvantum-like theme format could be used.

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

No branches or pull requests

4 participants