Fix #261: Show next-up sort icon when hovering over sortable list header
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
package theme
|
||||
|
||||
import (
|
||||
"image/color"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
const translucentAlpha = 155
|
||||
|
||||
type ThemedRectangle struct {
|
||||
widget.BaseWidget
|
||||
|
||||
rect *canvas.Rectangle
|
||||
|
||||
ColorName fyne.ThemeColorName
|
||||
Translucent bool
|
||||
BorderWidth float32
|
||||
BorderColorName fyne.ThemeColorName
|
||||
}
|
||||
@@ -29,7 +34,12 @@ func NewThemedRectangle(colorName fyne.ThemeColorName) *ThemedRectangle {
|
||||
func (t *ThemedRectangle) Refresh() {
|
||||
settings := fyne.CurrentApp().Settings()
|
||||
theme := settings.Theme()
|
||||
t.rect.FillColor = theme.Color(t.ColorName, settings.ThemeVariant())
|
||||
fc := theme.Color(t.ColorName, settings.ThemeVariant())
|
||||
if t.Translucent {
|
||||
r, g, b, _ := fc.RGBA()
|
||||
fc = color.NRGBA{R: uint8(r), G: uint8(g), B: uint8(b), A: translucentAlpha}
|
||||
}
|
||||
t.rect.FillColor = fc
|
||||
t.rect.StrokeWidth = t.BorderWidth
|
||||
t.rect.StrokeColor = theme.Color(t.BorderColorName, settings.ThemeVariant())
|
||||
t.BaseWidget.Refresh()
|
||||
|
||||
Reference in New Issue
Block a user