diff --git a/internal/color.go b/internal/color.go index e728cdf..5276c66 100644 --- a/internal/color.go +++ b/internal/color.go @@ -62,8 +62,6 @@ func RGBAToHSVA (r, g, b, a uint32) HSVA { // Adapted from: // https://www.cs.rit.edu/~ncs/color/t_convert.html - // FIXME: this does not always work! - component := func (x uint32) float64 { return clamp01(float64(x) / 0xFFFF) } diff --git a/labelswatch.go b/labelswatch.go index e882a65..10947cb 100644 --- a/labelswatch.go +++ b/labelswatch.go @@ -22,6 +22,7 @@ func NewLabelSwatch (value color.Color, text string) *LabelSwatch { label: NewLabel(text), } box.SetRole(tomo.R("objects", "LabelSwatch", "")) + box.swatch.label = text box.label.SetAlign(tomo.AlignStart, tomo.AlignMiddle) box.Add(box.swatch) box.Add(box.label) diff --git a/swatch.go b/swatch.go index ce7681b..8b87051 100644 --- a/swatch.go +++ b/swatch.go @@ -14,6 +14,7 @@ type Swatch struct { tomo.CanvasBox value color.Color editing bool + label string on struct { valueChange event.FuncBroadcaster } @@ -72,7 +73,11 @@ func (this *Swatch) Choose () { log.Println("objects: could not create swatch modal:", err) return } - window.SetTitle("Select Color") + if this.label == "" { + window.SetTitle("Select Color") + } else { + window.SetTitle(this.label) + } colorPicker := NewColorPicker(this.Value()) colorPicker.OnValueChange(func () {