A self-hosted dashboard that puts all your feeds in one place
Go aggregatordashboarddockerfeed-readergohomelabhomepagemonitoringredditrssrss-readerself-hostedstartpageyoutube
Change HSL values to floats
Svilen Markove2112e0d8313
diff --git a/internal/glance/config-fields.go b/internal/glance/config-fields.goindex cd244e5..f3a1649 100644--- a/internal/glance/config-fields.go+++ b/internal/glance/config-fields.go@@ -14,7 +14,7 @@ import ("gopkg.in/yaml.v3")-var hslColorFieldPattern = regexp.MustCompile(`^(?:hsla?\()?(\d{1,3})(?: |,)+(\d{1,3})%?(?: |,)+(\d{1,3})%?\)?$`)+var hslColorFieldPattern = regexp.MustCompile(`^(?:hsla?\()?([\d\.]+)(?: |,)+([\d\.]+)%?(?: |,)+([\d\.]+)%?\)?$`)const (hslHueMax = 360@@ -23,13 +23,13 @@ const ()type hslColorField struct {- Hue uint16- Saturation uint8- Lightness uint8+ Hue float64+ Saturation float64+ Lightness float64}func (c *hslColorField) String() string {- return fmt.Sprintf("hsl(%d, %d%%, %d%%)", c.Hue, c.Saturation, c.Lightness)+ return fmt.Sprintf("hsl(%.1f, %.1f%%, %.1f%%)", c.Hue, c.Saturation, c.Lightness)}func (c *hslColorField) UnmarshalYAML(node *yaml.Node) error {@@ -45,7 +45,7 @@ func (c *hslColorField) UnmarshalYAML(node *yaml.Node) error {return fmt.Errorf("invalid HSL color format: %s", value)}- hue, err := strconv.ParseUint(matches[1], 10, 16)+ hue, err := strconv.ParseFloat(matches[1], 64)if err != nil {return err}@@ -54,7 +54,7 @@ func (c *hslColorField) UnmarshalYAML(node *yaml.Node) error {return fmt.Errorf("HSL hue must be between 0 and %d", hslHueMax)}- saturation, err := strconv.ParseUint(matches[2], 10, 8)+ saturation, err := strconv.ParseFloat(matches[2], 64)if err != nil {return err}@@ -63,7 +63,7 @@ func (c *hslColorField) UnmarshalYAML(node *yaml.Node) error {return fmt.Errorf("HSL saturation must be between 0 and %d", hslSaturationMax)}- lightness, err := strconv.ParseUint(matches[3], 10, 8)+ lightness, err := strconv.ParseFloat(matches[3], 64)if err != nil {return err}@@ -72,9 +72,9 @@ func (c *hslColorField) UnmarshalYAML(node *yaml.Node) error {return fmt.Errorf("HSL lightness must be between 0 and %d", hslLightnessMax)}- c.Hue = uint16(hue)- c.Saturation = uint8(saturation)- c.Lightness = uint8(lightness)+ c.Hue = hue+ c.Saturation = saturation+ c.Lightness = lightnessreturn nil}