Module color

Module color 

Source
Expand description

BGR color type matching the HWP specification.

HWP documents store colors in BGR byte order (blue in the high byte, red in the low byte). This module provides Color, a zero-cost u32 wrapper that makes BGR handling explicit and safe.

Bits 24-31 are reserved (typically zero). The HWP5 format uses bit 24 as a transparency flag; this crate treats those bits as opaque data preserved through round-trips.

§Examples

use hwpforge_foundation::Color;

let red = Color::from_rgb(255, 0, 0);
assert_eq!(red.red(), 255);
assert_eq!(red.green(), 0);
assert_eq!(red.blue(), 0);
assert_eq!(red.to_raw(), 0x000000FF); // BGR: red in low byte

Structs§

Color
A color stored in BGR format, matching the HWP binary specification.