Themes

The theme package is an implementation of a material design inspired user interface. It provides the color palette, icons, font, and spacing information required to display the Fyne user interface:

The "baseline" material design color palette. Fyne uses a blue/gray variant by default

Widgets utilize the theme package extensively to match the current settings. For example, a button will be colored theme.ButtonColor() (unless it is a primary button, in which case it's theme.PrimaryColor()) and a label text is theme.TextColor(). Fyne also packages a standard font that can be accessed using theme.TextFont() (and variations), but these are not often needed. Instead, use fyne.TextStyle properties on a text object or label. However, theme.TextSize() and theme.Padding() are useful ways to match the user interface style in a custom widget.

Fyne themes also provide a collection of material design icons that can be used in any application, for example, theme.ContentPasteIcon(). Icons loaded from a theme will adapt to a new theme loading when used with any standard widgets. These icons are bundled with the toolkit and do not require any installation or additional items to be shipped with an application.

Any time you use a theme method, it's important to realize that the result may change over time—a new theme could be loaded or the user may change the configuration. To handle this correctly, you should implement fyne.ThemedObject, which requires a single function, ApplyTheme(). Inside this function, you should re-apply any theme-based values that were accessed. This functionality is handled automatically by widgets, so it is not commonly required that an application handles theme changes.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.209.201