From 669c638fad15503e2b42f2f703a634e653f7696f Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Fri, 16 Aug 2024 13:50:22 -0400 Subject: [PATCH] Fix transparency in color pickers again --- colorpicker.go | 2 +- swatch.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/colorpicker.go b/colorpicker.go index 7fc0206..0f5d3ed 100644 --- a/colorpicker.go +++ b/colorpicker.go @@ -64,7 +64,7 @@ func (this *HSVAColorPicker) SetValue (value color.Color) { if value == nil { value = color.Transparent } this.value = internal.HSVAModel.Convert(value).(internal.HSVA) this.hueSlider.SetValue(this.value.H) - this.alphaSlider.SetValue(float64(this.value.A) / 255) + this.alphaSlider.SetValue(float64(this.value.A) / 0xFFFF) } // OnValueChange specifies a function to be called when the user changes the diff --git a/swatch.go b/swatch.go index 66bc4e1..3cde31e 100644 --- a/swatch.go +++ b/swatch.go @@ -91,7 +91,7 @@ func (this *Swatch) Choose () { committed := false - colorPicker := NewColorPicker(this.Value()) + colorPicker := NewHSVAColorPicker(this.Value()) colorPicker.OnValueChange(func () { this.userSetValue(colorPicker.Value()) })