mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
widget/material: add focus and hover indicators to Clickable
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -154,6 +154,10 @@ func Disabled(c color.NRGBA) (d color.NRGBA) {
|
||||
// Hovered blends dark colors towards white, and light colors towards
|
||||
// black. It is approximate because it operates in non-linear sRGB space.
|
||||
func Hovered(c color.NRGBA) (h color.NRGBA) {
|
||||
if c.A == 0 {
|
||||
// Provide a reasonable default for transparent widgets.
|
||||
return color.NRGBA{A: 0x44, R: 0x88, G: 0x88, B: 0x88}
|
||||
}
|
||||
const ratio = 0x20
|
||||
m := color.NRGBA{R: 0xff, G: 0xff, B: 0xff, A: c.A}
|
||||
if approxLuminance(c) > 128 {
|
||||
|
||||
Reference in New Issue
Block a user