Manipulating and Mixing Colors

Transform individual colors and combine them without mutating the source values.

In this chapter

Read in order or jump directly to a specific page.

  1. Adjust lightness, chroma, and hue

    Choose the perceptual channel that matches the visual relationship you want to change.

  2. Create grayscale and inverted colors

    Choose between removing perceptual chroma and calculating an RGB negative, two operations with different visual meanings.

  3. Shift color temperature

    Use PHPColor's warm and cool hue heuristic without confusing it with physical color temperature.

  4. Create tints and shades

    Choose endpoint mixing for tints and shades, and distinguish it from changing perceptual lightness directly.

  5. Mix and composite colors

    Interpolate colors or composite a foreground over a backdrop.

  6. Build transformation chains

    Order immutable color operations so each stage has one declared purpose and the final output is verified after serialization.