{"record":{"id":"7d5349f9c1e2b0fe","repo":"quarkusio/quarkus","slug":"invalid-saturation-number-needs-to-be-between-0-a","errorCode":null,"errorMessage":"Invalid saturation, number needs to be between 0 and 100. 0% is a shade of gray and 100% is the full color (full saturation)","messagePattern":"Invalid saturation, number needs to be between 0 and 100\\. 0% is a shade of gray and 100% is the full color \\(full saturation\\)","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/devui/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeContentProcessor.java","lineNumber":1335,"sourceCode":"    /**\n     * This represents a HSLA color\n     * see https://www.w3schools.com/html/html_colors_hsl.asp\n     */\n    static class Color {\n        private int hue; // Defines a degree on the color wheel (from 0 to 360) - 0 (or 360) is red, 120 is green, 240 is blue\n        private int saturation; // Defines the saturation; 0% is a shade of gray and 100% is the full color (full saturation)\n        private int lightness; // Defines the lightness; 0% is black, 50% is normal, and 100% is white\n        private double alpha; // Defines the opacity; 0 is fully transparent, 100 is not transparent at all\n\n        private Color(int hue, int saturation, int lightness, double alpha) {\n            if (hue < 0 || hue > 360) {\n                throw new RuntimeException(\n                        \"Invalid hue, number needs to be between 0 and 360. Defines a degree on the color wheel\");\n            }\n            this.hue = hue;\n\n            if (saturation < 0 || saturation > 100) {\n                throw new RuntimeException(\n                        \"Invalid saturation, number needs to be between 0 and 100. 0% is a shade of gray and 100% is the full color (full saturation)\");\n            }\n            this.saturation = saturation;\n\n            if (lightness < 0 || lightness > 100) {\n                throw new RuntimeException(\n                        \"Invalid lightness, number needs to be between 0 and 100. 0% is black, 50% is normal, and 100% is white\");\n            }\n            this.lightness = lightness;\n\n            if (alpha < 0 || alpha > 1) {\n                throw new RuntimeException(\n                        \"Invalid alpha, number needs to be between 0 and 1. 0 is fully transparent, 1 is not transparent at all\");\n            }\n            this.alpha = alpha;\n        }\n\n        @Override","sourceCodeStart":1317,"sourceCodeEnd":1353,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/devui/deployment/src/main/java/io/quarkus/devui/deployment/BuildTimeContentProcessor.java#L1317-L1353","documentation":"The BuildTimeContentProcessor.Color record validates the HSL color components used to generate per-extension Dev UI theme colors. This error is thrown by the Color constructor when the saturation is outside 0–100, since saturation is expressed as a percentage (0 = gray, 100 = full color).","triggerScenarios":"Constructing a Color with a negative saturation or saturation greater than 100 during build-time Dev UI content generation.","commonSituations":"A custom extension computing saturation from a 0–1 float without scaling to percent; passing an HSL value from a design tool that uses 0–1 saturation; typo in a hardcoded theme value.","solutions":["Scale 0–1 saturation to percent: saturation = Math.round(sat01 * 100)","Clamp with Math.max(0, Math.min(100, saturation)) before constructing the Color","Fix the hardcoded or computed value to lie within 0–100"],"exampleFix":"// before\nColor c = new Color(210, 1.0, 50, 1.0); // 1.0 is 0-1 scale\n// after\nColor c = new Color(210, (int) Math.round(1.0 * 100), 50, 1.0);","handlingStrategy":"validation","validationCode":"int s = (int) Math.round(sat01 * 100); // convert 0-1 to percent\nif (s < 0 || s > 100) throw new IllegalArgumentException(\"saturation must be 0-100\");","typeGuard":"boolean isValidSaturation(int s) { return s >= 0 && s <= 100; }","tryCatchPattern":"try {\n    Color c = new Color(hue, sat, light, alpha);\n} catch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Invalid saturation\")) {\n        c = new Color(hue, Math.max(0, Math.min(100, sat)), light, alpha);\n    } else throw e;\n}","preventionTips":["Convert 0–1 floats to percent before passing saturation","Clamp saturation at call sites","Test boundaries 0 and 100"],"tags":["devui","build-time","color","argument-validation"],"backgroundTag":"invalid-argument-range","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}