malisipi / mui

A Cross-Platform UI Library
https://malisipi.github.io/mui/
Apache License 2.0
95 stars 9 forks source link

Color issue or theme override needed? #6

Closed Wajinn closed 1 year ago

Wajinn commented 1 year ago

Since WindowConfig seems not to allow selecting the true rgb color with color:, and instead gives some variation of theme colors. Maybe something can be done. Possibly an explicit theme: false, to allow user defined background color for window.

mut app := m.create(m.WindowConfig{title: "Test", color: [255,250,250], scrollbar: false, width: 200, height: 200, ask_quit: true})

malisipi commented 1 year ago

I am using the rgb color to create color palette. So, you are seeing variants of the main color. If you're wanting to set background color. You can modify color palette or create a rect with your color. But supporting a background color is good idea.

Wajinn commented 1 year ago

Yes, some way that allows setting the background color, and maybe turning the theme off, as an option in WindowConfig would appear to be more obvious and better for users.

Had already noticed that rect could be used as a workaround. However, (on Windows) there is an intermittent redraw/resize issue that shows up at the top and right border, as a kind of dark line. I'm thinking it has something to do with conflicting colors involving near white, as doesn't appear to show up in themes or when the window is alone. I have been playing around if there was an easy way to completely overcome it. Maybe making rect bigger than the visible window, or something. This does not appear to be an issue with your code, but rather the gx/gg implementation, so if a fix is needed for that specifically then it will likely come from over there.

mut app := m.create(m.WindowConfig{title: "Test", color: [255,250,250], scrollbar: false, width: 200, height: 200, ask_quit: true})
app.rect(m.Widget{id: "rect", x: 0, y: 0, width: "100%x" height: "100%y", background: gx.Color{255, 250, 250, 255}})
app.run()
malisipi commented 1 year ago

Still needed to add color option to create color palette (for widgets) but you can also use background option.

I recommend to set color; if you don't, mui will creates custom color palette according to users system theme. That can make your application with bad looking (like white text onto light yellow background etc.)

Example usage: https://github.com/malisipi/mui/blob/main/examples/custom_background.v