glanceapp/glance · error
HSL saturation must be between 0 and %d
Error message
HSL saturation must be between 0 and %d
What it means
Returned by hslColorField.UnmarshalYAML when the saturation component of an HSL color string exceeds hslSaturationMax (100) after parsing as float. Like the hue check it fires only after the overall pattern matched, so the syntax is right but the second component is out of range.
Source
Thrown at internal/glance/config-fields.go:77
return fmt.Errorf("invalid HSL color format: %s", value)
}
hue, err := strconv.ParseFloat(matches[1], 64)
if err != nil {
return err
}
if hue > hslHueMax {
return fmt.Errorf("HSL hue must be between 0 and %d", hslHueMax)
}
saturation, err := strconv.ParseFloat(matches[2], 64)
if err != nil {
return err
}
if saturation > hslSaturationMax {
return fmt.Errorf("HSL saturation must be between 0 and %d", hslSaturationMax)
}
lightness, err := strconv.ParseFloat(matches[3], 64)
if err != nil {
return err
}
if lightness > hslLightnessMax {
return fmt.Errorf("HSL lightness must be between 0 and %d", hslLightnessMax)
}
c.H = hue
c.S = saturation
c.L = lightness
return nil
}
View on GitHub (pinned to 91324e8de7)
Solutions
- Keep saturation between 0% and 100%.
- Re-check the source of the value if it came from a picker using a different scale.
- Validate config with `glance config:validate`.
Example fix
# before primary-color: 200 150% 40% # after primary-color: 200 60% 40%
Defensive patterns
Strategy: validation
Validate before calling
python3 -c "
import re,sys
hsl=re.compile(r'^(\d+(?:\.\d+)?) (\d+(?:\.\d+)?)% (\d+(?:\.\d+)?)%$')
m=hsl.match('200 150% 40%')
sys.exit('saturation out of range' if m and float(m.group(2))>100 else 0)
" Prevention
- Keep saturation on the 0-100% scale.
- When porting from 0-1 scales, multiply by 100 and append %.
When it happens
Trigger: An HSL color such as `200 150% 40%` — saturation above 100%.
Common situations: Copying saturation values from tools that emit 0-255 or 0-1 scales; typos; forgetting the % conversion when porting from another format.
Related errors
- HSL hue must be between 0 and %d
- HSL lightness must be between 0 and %d
- invalid HSL color format: %s
- URL is required
- nested groups are not supported
AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15).
Data as JSON: /api/errors/275824e92cf0d3c9.
Report an issue: GitHub.