Image Translucency – Fyne Golang GUI Tutorial 77
This is fyne series tutorial.
in this tutorial, we are going to learn about translucency in fyne , Golang GUI.
To declear image we normally use :
img := canvas.NewImageFromFile("bg.jpg")
To modify translucency we can use values from 0 to 0.9
img.Translucency = 0.9 // you can use 0 to 0.99
package main // import fyne import ( "fyne.io/fyne/v2" "fyne.io/fyne/v2/app" "fyne.io/fyne/v2/canvas" ) func main() { // new app a := app.New() // new window w := a.NewWindow("Image Translucency-Alpha") w.Resize(fyne.NewSize(400, 400)) img := canvas.NewImageFromFile("bg.jpg") img.Translucency = 0.9 // you can use 0.1 to 0.99 // set content w.SetContent(img) // we will create image variable w.ShowAndRun() }