HSL Lightness Shift Percent
Adjust actual RGB through HSL using additive signed lightness percentage points, clipping only lightness and reporting clipping; not multiplicative brightness, CSS matrix filtering or perceptually uniform change.
Description
An additive HSL lightness shift uses percentage points rather than a brightness multiplier.
When to use HSL Lightness Shift Percent
Use HSL Lightness Shift Percent when you need to evaluate the supplied records under the calculation and evidence rules below. No linear-light brightness scaling, matrix filtering or uniform perceptual change is supplied.
Prepare colors in the stated color space and scale. Use encoded RGB fractions, linear RGB, Lab, xy, byte values or ink percentages exactly as requested; supply caller tolerances and reference conditions.
How to use HSL Lightness Shift Percent and understand its results
- Prepare colors in the stated color space and scale. Use encoded RGB fractions, linear RGB, Lab, xy, byte values or ink percentages exactly as requested; supply caller tolerances and reference conditions.
- Enter baseRgb, signedLightnessPercentagePoints using the field table and calculation rules, then run the tool.
- Read shiftedHsl, shiftedRgb, lightnessClamped. The explanation below defines the units, signs, ordering and any flags or placeholder values.
- If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
| Input field | Meaning | Value type; see rules below | Requirement |
|---|---|---|---|
| baseRgb | Base rgb | list of number | Required |
| signedLightnessPercentagePoints | Signed lightness percentage points | number | Required |
Enter normalized RGB and finite signed change±100 percentage points. Return shifted HSL/RGB and clipping flag.
newL=clamp(oldL+percentagePoints/100,0,1) Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.
| Output field | Meaning | Value type |
|---|---|---|
| shiftedHsl | Shifted hsl | list of number |
| shiftedRgb | Shifted rgb | list of number |
| lightnessClamped | Lightness clamped | boolean |
{
"input": {
"baseRgb": [
1,
0,
0
],
"signedLightnessPercentagePoints": 25
},
"output": {
"shiftedHsl": [
0,
1,
0.75
],
"shiftedRgb": [
1,
0.5,
0.5
],
"lightnessClamped": false
}
} Limitations and assumptions
No linear-light brightness scaling, matrix filtering or uniform perceptual change is supplied.
Numeric inputs, where present, must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Numeric lists are limited to 10,000 entries; string lists to 128 strings of at most 128 characters each. The rules above may impose smaller limits. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors. A successfully returned false flag is an evaluated outcome; its meaning is explained above.
Alternative or Complementary methods
Use HSL Saturation Adjust Percent: An additive HSL saturation change uses percentage points. Clipping keeps saturation within its normalized range. For a complementary task, use Dark-Mode Lightness Inversion Heuristic: A dark-theme heuristic can invert HSL lightness and constrain it to chosen bounds. Contrast needs a separate check.
Further background: CSS Color Module Level 4.
References
-
HSL Lightness Shift Percent — tool.io
-
CSS Color Module Level 4 — World Wide Web Consortium
Similar or alternative tools
- HSL Saturation Adjust Percent
An additive HSL saturation change uses percentage points. Clipping keeps saturation within its normalized range.
- Dark-Mode Lightness Inversion Heuristic
A dark-theme heuristic can invert HSL lightness and constrain it to chosen bounds. Contrast needs a separate check.