optic-color 0.0.3

Zero-dependency color library for Optic engine — RGBA, HSV, HSL, gradients, named constants
Documentation
  • Coverage
  • 34.86%
    38 out of 109 items documented9 out of 9 items with examples
  • Size
  • Source code size: 41.18 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.4 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Kono-o/optic-engine
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Kono-o

optic-color

Colour types and conversions for the Optic engine.

Provides RGBA, RGB, HSV, HSL with conversions between each other, sRGB/linear gamma transfer, hex parsing, lighten/darken/saturate, and colour gradients.

Key types

Type Description
RGBA Red-green-blue-alpha (0–1 f32)
RGB RGB without alpha
HSV Hue-saturation-value
HSL Hue-saturation-lightness
Gradient Multi-stop colour ramp
use optic_color::RGBA;

let red = RGBA::new(1.0, 0.0, 0.0, 1.0);
let hex = RGBA::from_hex_u32(0xFF8800FF);
let lit = red.lighten(0.2);