Dark-Mode Lightness Inversion Heuristic

Apply explicitly heuristic HSL lightness inversion and caller dark-mode bounds, retaining hue/saturation and clipping evidence; not accessible theming, contrast compliance or perceptual inversion.

Description

A dark-theme heuristic can invert HSL lightness and constrain it to chosen bounds.

A dark-theme heuristic can invert HSL lightness and constrain it to chosen bounds. Contrast needs a separate check.1

Enter normalized RGB and ordered lightness bounds 0–1. Convert to HSL, retain hue/saturation and invert/clamp lightness. Return HSL/RGB and clipping flag.

When to use Dark-Mode Lightness Inversion Heuristic

Use Dark-Mode Lightness Inversion Heuristic when you need to evaluate the supplied records under the calculation and evidence rules below. No accessible theming, contrast compliance or perceptual inversion is established.

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 Dark-Mode Lightness Inversion Heuristic 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, callerMinimumDarkModeLightness, callerMaximumDarkModeLightness using the field table and calculation rules, then run the tool.
  3. Read heuristicDarkHsl, heuristicDarkRgb, invertedLightnessClipped. 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
callerMinimumDarkModeLightnessCaller minimum dark mode lightnessnumberRequired
callerMaximumDarkModeLightnessCaller maximum dark mode lightnessnumberRequired

Enter normalized RGB and ordered lightness bounds 0–1. Convert to HSL, retain hue/saturation and invert/clamp lightness. Return HSL/RGB and clipping flag.

rawLightness=1−original; outputLightness=clamp(raw,callerBounds)

Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.

Output fieldMeaningValue type
heuristicDarkHslHeuristic dark hsllist of number
heuristicDarkRgbHeuristic dark rgblist of number
invertedLightnessClippedInverted lightness clippedboolean
json
{
  "input": {
    "baseRgb": [
      1,
      0,
      0
    ],
    "callerMinimumDarkModeLightness": 0.1,
    "callerMaximumDarkModeLightness": 0.4
  },
  "output": {
    "heuristicDarkHsl": [
      0,
      1,
      0.4
    ],
    "heuristicDarkRgb": [
      0.8,
      0,
      0
    ],
    "invertedLightnessClipped": true
  }
}

Limitations and assumptions

No accessible theming, contrast compliance or perceptual inversion is established.

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 Auto Black/White Text Picker: Opaque background relative luminance determines black and white text contrast. The larger ratio is an objective choice within these two candidates. For a complementary task, use HSL Lightness Shift Percent: An additive HSL lightness shift uses percentage points rather than a brightness multiplier. Clipped values retain the source hue/saturation.

References

  1. Dark-Mode Lightness Inversion Heuristic — tool.io

Similar or alternative tools

  • Auto Black/White Text Picker

    Opaque background relative luminance determines black and white text contrast. The larger ratio is an objective choice within these two candidates.

  • HSL Lightness Shift Percent

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

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