ph-color 0.1.0

Fixed-point no_std color math for embedded targets: conversion, transfer functions, matrices, gain, and interpolation
Documentation
  • Coverage
  • 100%
    112 out of 112 items documented1 out of 70 items with examples
  • Size
  • Source code size: 7.5 MB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.7 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 7s Average build duration of successful builds.
  • all releases: 5s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • photon-circus/ph-color
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • swgiacomelli

ph-color

Fixed-point no_std color math for embedded targets.

crates.io docs.rs

[!NOTE] Lifecycle: Active Distribution: Version 0.1.0 on crates.io, with API documentation on docs.rs. Model conformance: N/A Physical evidence: N/A

This package applies baked coefficients and tables. It does not derive, invert, adapt, or solve. Host derivation lives in ph-color-bake.

[dependencies]
ph-color = "0.1"
use ph_color::{Color, Linear, Q0_16, Srgb};

let black = Color::<Srgb, Linear>::new([Q0_16::ZERO; 3]);
let white = Color::<Srgb, Linear>::new([Q0_16::ONE; 3]);
let midpoint = black.lerp(white, Q0_16::from_raw(32_768));
assert!(midpoint.ch[0].to_raw() >= 32_768);

The crate currently exposes quantize / expand, Color type-state, numeric Matrix3 / Gain apply, InterpLut, lerp, Gradient, shipped sRGB EOTF/OETF InterpLut constants, feature oklab (linear-sRGB ↔ Oklab), and optional feature = "f32" (ColorF32 and *_f32). Oklab f32 is out of scope. Host ph-color-bake derives tables. Frozen golden vectors in tests/golden/ are replayed by host tests. Named-consumer host sketches are in examples/. Numeric and type-state guarantees are in the repository numeric policy.

Compatibility and limits

  • MSRV: Rust 1.94.0, edition 2024.
  • Default build: no_std, no allocation, no unsafe code, no f64, and zero dependencies.
  • Optional features: f32 and oklab; Oklab has no f32 entry points.
  • Fixed-point matrix and gain output uses one widening accumulation followed by round-half-away-from-zero and saturation. It never wraps.
  • Matrices and gains accept linear colors; transfer LUTs cross linear/encoded state; encoded interpolation is limited to perceptual color spaces.
  • Color processing stops at quantization. Firmware owns dithering, residual accumulation, output packing, and hardware I/O.

License

MIT