Skip to main content

HSL Range

This rule checks that the HSL values of pixels in an image fall within specified ranges for Hue, Saturation, and Lightness.

Parameter table

paramunitrequireddescription
minHue°noMinimum hue value in degrees (minHue).
maxHue°noMaximum hue value in degrees (maxHue).
minSaturation%noMinimum saturation value in percentage (minSaturation).
maxSaturation%noMaximum saturation value in percentage (maxSaturation).
minLightness%noMinimum lightness value in percentage (minLightness).
maxLightness%noMaximum lightness value in percentage (maxLightness).

Detailed description

HSL stands for Hue, Saturation, and Lightness, and it is a color model used in computer graphics, design, and image editing. HSL

  • Hue Check:

    • Ensures that all colors in the image fall within the specified hue range ([minHue, maxHue]) in degrees.
    • Black, white, and gray colors are exempt from this hue check.
  • Saturation Check:

    • Calculates the average saturation value across the entire image.
    • Validates that the average saturation is within the specified range ([minSaturation, maxSaturation]) in percentage.
  • Lightness Check:

    • Calculates the average lightness value across the entire image.
    • Validates that the average lightness is within the specified range ([minLightness, maxLightness]) in percentage.

Correction

The correction process proposes a maximum of two alternatives:

Hue Correction:

  1. Redistribution of Hue:
    • The first proposal redistributes hues to fit within the specified hue range.
    • This aims to maintain the original color diversity.
  2. Gray Replacement:
    • The second proposal replaces colors outside the specified hue range with grayscale tones.
    • This ensures compliance with the specified hue constraints, with a focus on areas that do not comply with the specified hue constraints.

Saturation and Lightness Correction:

  • For both saturation and lightness, the correction adjusts the average value to fall within the specified range.

How to setup

This rule evaluates whether an image's HSL values conform to specified constraints. Key parameters include:

  • minHue: Minimum hue value in degrees.
  • maxHue: Maximum hue value in degrees.
  • minSaturation: Minimum saturation value in percentage.
  • maxSaturation: Maximum saturation value in percentage.
  • minLightness: Minimum lightness value in percentage.
  • maxLightness: Maximum lightness value in percentage.

All parameters are optional, but at least one is expected.

Creator tips

  • Analyze the image's HSL values to understand the distribution of colors.
  • Utilize image editing tools to adjust hue, saturation, and lightness.

Examples

valuevalidmaxHueminHueminLightnessminSaturationdescription
red30-30The image should be made up of shades of red only.
green30-30The image should be made up of shades of red only.
flashy4080The image should be made up of flashy colors.