www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - color-d 0.2.0 =?UTF-8?B?4oCT?= type-safe color math (Oklab/OKLCH,

reply alex-1974 <alex.leisser gmail.com> writes:
Hi all,

I've released color-d 0.2.0, a small, allocation-free 
color-mathematics library for D. It is  safe pure nothrow  nogc 
throughout and usable in CTFE.

The idea: the color space is part of the type, and every step is 
explicit. Encoded and linear sRGB are different types, 
conversions never clip silently, and there is no default gamut 
mapper.

```dlang
import color;

const display =
     SRgbd(0.82, 0.25, 0.12)
         .toLinear.toXyzD65.toOklab.toOklch
         .withLightness(0.70).withChroma(0.16)
         .gamutMapRayTraceToLinearSRgb
         .toSRgb;
```

What's in it: sRGB/linear/XYZ D65/Oklab/OKLCH, CIELAB and 
CIEDE2000, straight and premultiplied alpha with linear-light 
compositing, interpolation with hue-path control, CSS Color 4 
gamut mapping (Local MINDE, Ray Trace), WCAG 2 contrast, CVD 
simulation (Brettel, ViƩnot, Machado), and packed SRgb8/SRgba8 
with hex interop.

What it is not: no HSL/HSV, wide-gamut spaces or CSS parser yet, 
and no theme or palette policy. The API is pre-1.0 and may still 
change.

It targets DMD 2.112/2.113 and LDC 1.42/1.43 on Linux x86-64. 
Feedback on other platforms is very welcome.

Docs: [github pages](https://alex-1974.github.io/color-d/)
Repo: [github](https://github.com/alex-1974/color-d)
DUB:
 dependency "color-d" version="~>0.2.0"
Feedback, issues and use cases are welcome.
Oct 04
parent ai_will_win <contact openai.com> writes:
On Sunday, 4 October 2026 at 08:52:40 UTC, alex-1974 wrote:
 Hi all,

 Feedback, issues and use cases are welcome.
Which AI models do you use?
Oct 04