Hndy.Color

by againey

A utility library providing classes and functions for working with various color spaces and color values.

Internal
8 hours ago
2.0
0
Owner:
againey
Source:
https://github.com/againey/hndy-facto...
Homepage:
N/A
License:
0BSD
Created:
8 hours ago
Latest Version:
1.0.0 (8 hours ago)
Factorio version:
2.0
Downloaded by:
0 users

Color Spaces

  • RGB (red, green, blue)
  • sRGB (gamma-corrected RGB)
  • HSV (hue, saturation, value)
  • HSL (hue, saturation, lightness)
  • HWB (hue, whiteness, blackness)
  • CIELAB (lightness, green-to-red, blue-to-yellow)
  • CIELCh (lightness, chroma, hue)
  • Oklab (lightness, green-to-red, blue-to-yellow)
  • Oklch (lightness, chroma, hue)

Game colors are in the sRGB color space, so favor the ColorSrgb class for directly working in the native color space.

For constructing hue-based colors based on intuitive input components, consider using ColorHsl, ColorHsv, or ColorHwb.
However, if you are doing more advanced calculations, especially if you are interpolating between colors and want the
intermediate colors to maintain consistent brightness and vibrancy relative to their source and target, ColorOklch is the
recommended choice.

Operations

  • Conversion between color spaces
  • Conversion to and from game color
  • Conversion to and from CSS-compatible components
  • Gamut clamping and component normalization
  • Clone with mutation
  • Interpolation between two colors