Skip to content
Discussion options

You must be logged in to vote

Thank you so much! I was starting to think I'd have to look for another GUI toolkit. I'm leaving this example so it can help others.

package main

import (
	"image/color"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/theme"
	"fyne.io/fyne/v2/widget"
)

type CustomTheme struct {
	fyne.Theme
	labelColor color.Color
}

func (t *CustomTheme) Color(name fyne.ThemeColorName, variant fyne.ThemeVariant) color.Color {
	if name == theme.ColorNameForeground {
		return t.labelColor
	}
	return t.Theme.Color(name, variant)
}

func main() {
	a := app.New()
	w := a.NewWindow("Colored labels (real, without canvas.Text!!!)")

	// Purple label example
	purpleLabel :=

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@dweymouth
Comment options

@limafresh
Comment options

@dweymouth
Comment options

@limafresh
Comment options

Answer selected by limafresh
@andydotxyz
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants