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.

An additive HSL lightness shift uses percentage points rather than a brightness multiplier. Clipped values retain the source hue/saturation.1, 2

Enter normalized RGB and finite signed change±100 percentage points. Return shifted HSL/RGB and clipping flag.

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

  1. 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.
  2. Enter baseRgb, signedLightnessPercentagePoints using the field table and calculation rules, then run the tool.
  3. Read shiftedHsl, shiftedRgb, lightnessClamped. The explanation below defines the units, signs, ordering and any flags or placeholder values.
  4. 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 fieldMeaningValue type; see rules belowRequirement
baseRgbBase rgblist of numberRequired
signedLightnessPercentagePointsSigned lightness percentage pointsnumberRequired

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 fieldMeaningValue type
shiftedHslShifted hsllist of number
shiftedRgbShifted rgblist of number
lightnessClampedLightness clampedboolean
json
{
  "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

  1. HSL Lightness Shift Percent — tool.io

  2. CSS Color Module Level 4 — World Wide Web Consortium

Similar or alternative tools

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies