fyne-io / fyne

Cross platform GUI toolkit in Go inspired by Material Design
https://fyne.io/
Other
25.12k stars 1.4k forks source link

Additional label properties. #3490

Open kendellfab opened 1 year ago

kendellfab commented 1 year ago

Checklist

Is your feature request related to a problem?

Labels are missing the ability to size and color.

Is it possible to construct a solution with the existing API?

No response

Describe the solution you'd like to see.

I want to start off by saying that I appreciate the work that the Fyne team has done. I'm just learning, but have enjoyed the toolkit so far.

Below I have an example of an application that I'm learning with, it is a team based Jeopardy style quiz game. I'm running into some issues that make this application less usable than I'd like. The window on the left is meant to run on a laptop screen and the window on the right is meant to be run on a TV or projector. For the control window on the left, it makes sense to maintain the default label and button sizes, as it will be running right in front of the user. But the game window, which is meant to be observed by a whole room, is almost impossible to read at distance.

fyne-question

I tried working with a canvas text object for the section in green, and setting a text size, but then I lost word wrap capabilities that could be provided by a label.

Those highlighted in blue would be nice to be able to style a more prominent size and color as well (arguably could be done by the canvas text as word wrap is less important here).

As I've read over the documentation and discussions online, I have found many sources say that these components are intentionally left as they are, with a lack of customization. Which I can appreciate that that works well in the default case. But I feel that I have just provided a simple use case where it would be beneficial to have more access to customize the display.

Here is an example built in GTK that works well with the display window (right) sizing and the control window (left).

Screenshot from 2022-12-20 16-38-05

Although, this can be built in GTK, it does not provide the ease OS portability that I've turned to Fyne to provide.

andydotxyz commented 1 year ago

For the scaling of the UI remember that this entire toolkit is vector based and designed to scale according to use-case. If this were a TV app it would scale automatically, but I guess you have a PC and want it to set up as a TV, which is totally possible - just set something like FYNE_SCALE=2.5 in your environment. If your OS was set to scale accordingly this would already be matched.

With regards to Label it is indeed intended to be simple - setting colour or size on a standard component can (and will) break apps when user changes theme and/or OS settings. As the API is based around intent instead of customisation you should look at RichText which contains various semantic text enhancements that help. For standard things like "header" or "quote" the API is already there, and can be loaded from Markdown for simplicity. You are also able to extend it with custom types so you could define a text style that marks a "success" text and state that it's colour match your desire for success marking.