{"record":{"id":"116c8e0012cb9381","repo":"glanceapp/glance","slug":"hsl-hue-must-be-between-0-and-d","errorCode":null,"errorMessage":"HSL hue must be between 0 and %d","messagePattern":"HSL hue must be between 0 and (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/glance/config-fields.go","lineNumber":68,"sourceCode":"\tvar value string\n\n\tif err := node.Decode(&value); err != nil {\n\t\treturn err\n\t}\n\n\tmatches := hslColorFieldPattern.FindStringSubmatch(value)\n\n\tif len(matches) != 4 {\n\t\treturn fmt.Errorf(\"invalid HSL color format: %s\", value)\n\t}\n\n\thue, err := strconv.ParseFloat(matches[1], 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif hue > hslHueMax {\n\t\treturn fmt.Errorf(\"HSL hue must be between 0 and %d\", hslHueMax)\n\t}\n\n\tsaturation, err := strconv.ParseFloat(matches[2], 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif saturation > hslSaturationMax {\n\t\treturn fmt.Errorf(\"HSL saturation must be between 0 and %d\", hslSaturationMax)\n\t}\n\n\tlightness, err := strconv.ParseFloat(matches[3], 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif lightness > hslLightnessMax {\n\t\treturn fmt.Errorf(\"HSL lightness must be between 0 and %d\", hslLightnessMax)","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/glanceapp/glance/blob/91324e8de762702e97b0ac5c8e36271d644d8642/internal/glance/config-fields.go#L50-L86","documentation":"Returned by hslColorField.UnmarshalYAML when the hue component of an HSL color string parses as a float but exceeds hslHueMax (360). The value matched the syntax pattern, so this is a range check failure specifically on the first component; the message interpolates the max (360).","triggerScenarios":"An HSL color like `370 50% 40%` or `400 50% 40%` — any hue greater than 360 after strconv.ParseFloat succeeds.","commonSituations":"Typos adding an extra digit (e.g. 2200); assuming hue wraps around like some CSS implementations; feeding degrees from a calculation that overflowed the 0-360 range.","solutions":["Keep hue in the range 0-360 (wrap manually: 370 is equivalent to 10).","Check for accidental extra digits in the first number.","Validate with `glance config:validate` after theme edits."],"exampleFix":"# before\nprimary-color: 380 60% 50%\n\n# after\nprimary-color: 20 60% 50%","handlingStrategy":"validation","validationCode":"python3 -c \"\nimport re,sys\nhsl=re.compile(r'^(\\d+(?:\\.\\d+)?) (\\d+(?:\\.\\d+)?)% (\\d+(?:\\.\\d+)?)%$')\nm=hsl.match('370 50% 40%')\nsys.exit('hue out of range' if m and float(m.group(1))>360 else 0)\n\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Wrap hue modulo 360 when computing colors programmatically.","Use a color tool that emits hue in 0-360."],"tags":["config","theme","color","range","validation"],"backgroundTag":null,"analyzedSha":"91324e8de762702e97b0ac5c8e36271d644d8642","analyzedAt":"2026-08-15T14:12:54.279Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}