netmaker/netclient/gui/components/text.go
2022-05-10 09:26:54 -04:00

22 lines
449 B
Go

package components
import (
"image/color"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/widget"
)
// ColoredText - renders a colored label
func ColoredText(text string, color color.Color) *fyne.Container {
btn := widget.NewLabel(text)
bgColor := canvas.NewRectangle(color)
return container.New(
layout.NewGridWrapLayout(fyne.NewSize(400, 100)),
bgColor,
btn,
)
}