giu icon indicating copy to clipboard operation
giu copied to clipboard

suggestion: CSS styles

Open gucio321 opened this issue 3 years ago • 6 comments

INTRODUCTION

Hi there! A few days ago, I heard, that JavaFX uses CSS stylesheets for windowed-apps styling.

What about adding such a feature as an extension of giu?

technical aspect

at the moment, there is setTheme method that sets all styles in master window. we can parse css file's body class and apply it there. In addition, we can also add CSSWidget and use it e.g.:

CSSTag("mycustomstyle").To(/*some layout*/)

and during master window creation:

wnd := giu.NewMasterWindow(...)
err := wnd.StyleFromCSS([]byte(myStyle))

@AllenDang what do you think about this idea? could it be a part of giu? Or meybe it'd be better idea to write a separated module (like css-giu-widget (IMO it wouldn't be so simple to do, because of privacy of some in-giu stuff) ).

gucio321 avatar Feb 21 '22 18:02 gucio321

@gucio321 I think we could define a theme dsl rather than use css directly. Because css is very complex.

AllenDang avatar Feb 22 '22 02:02 AllenDang

hmm, but imo, we could try to use https://github.com/napsy/go-css to parse css files. I dont think it'd be really complicated

gucio321 avatar Feb 27 '22 17:02 gucio321

At present, I am considering designing a QML or HTML CSS to assist in designing styles

Seikaijyu avatar Jul 14 '22 10:07 Seikaijyu

Giu's layout code is not so comfortable for me to write. I want to simplify the code that needs to be written and increase readability through the generator

Seikaijyu avatar Jul 14 '22 10:07 Seikaijyu

Of course, this is obviously impossible for me at present (I mean I need to fully understand the knowledge related to giu layout, which may take some time)

Seikaijyu avatar Jul 14 '22 10:07 Seikaijyu

hmm, but imo, we could try to use https://github.com/napsy/go-css to parse css files. I dont think it'd be really complicated

It won't be very complicated, but I think it may be much better to extend giu than to implement it inside giu Internal implementation means the need to interpret and execute, which will bring some runtime overhead, which is detrimental to Gui programs

Seikaijyu avatar Jul 14 '22 10:07 Seikaijyu