<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@csstools/color-helpers](./color-helpers.md)

## color-helpers package

## Functions

<table><thead><tr><th>

Function


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[a98\_RGB\_to\_XYZ\_D50(x)](./color-helpers.a98_rgb_to_xyz_d50.md)


</td><td>


</td></tr>
<tr><td>

[clip(color)](./color-helpers.clip.md)


</td><td>


</td></tr>
<tr><td>

[contrast\_ratio\_wcag\_2\_1(color1, color2)](./color-helpers.contrast_ratio_wcag_2_1.md)


</td><td>

WCAG 2.1 contrast ratio


</td></tr>
<tr><td>

[gam\_P3(RGB)](./color-helpers.gam_p3.md)


</td><td>

Convert an array of linear-light display-p3 RGB in the range 0.0-1.0 to gamma corrected form


</td></tr>
<tr><td>

[gam\_sRGB(RGB)](./color-helpers.gam_srgb.md)


</td><td>

Convert an array of linear-light sRGB values in the range 0.0-1.0 to gamma corrected form Extended transfer function: For negative values, linear portion extends on reflection of axis, then uses reflected pow below that


</td></tr>
<tr><td>

[HSL\_to\_XYZ\_D50(x)](./color-helpers.hsl_to_xyz_d50.md)


</td><td>


</td></tr>
<tr><td>

[HWB\_to\_XYZ\_D50(x)](./color-helpers.hwb_to_xyz_d50.md)


</td><td>


</td></tr>
<tr><td>

[inGamut(x)](./color-helpers.ingamut.md)


</td><td>


</td></tr>
<tr><td>

[Lab\_to\_XYZ\_D50(x)](./color-helpers.lab_to_xyz_d50.md)


</td><td>


</td></tr>
<tr><td>

[LCH\_to\_XYZ\_D50(x)](./color-helpers.lch_to_xyz_d50.md)


</td><td>


</td></tr>
<tr><td>

[lin\_P3\_to\_XYZ\_D50(x)](./color-helpers.lin_p3_to_xyz_d50.md)


</td><td>


</td></tr>
<tr><td>

[lin\_P3\_to\_XYZ(rgb)](./color-helpers.lin_p3_to_xyz.md)


</td><td>

Convert an array of linear-light display-p3 values to CIE XYZ using D65 (no chromatic adaptation)


</td></tr>
<tr><td>

[lin\_P3(RGB)](./color-helpers.lin_p3.md)


</td><td>

Convert an array of display-p3 RGB values in the range 0.0 - 1.0 to linear light (un-companded) form.


</td></tr>
<tr><td>

[lin\_sRGB\_to\_XYZ\_D50(x)](./color-helpers.lin_srgb_to_xyz_d50.md)


</td><td>


</td></tr>
<tr><td>

[lin\_sRGB\_to\_XYZ(rgb)](./color-helpers.lin_srgb_to_xyz.md)


</td><td>

Convert an array of linear-light sRGB values to CIE XYZ using sRGB's own white, D65 (no chromatic adaptation)


</td></tr>
<tr><td>

[lin\_sRGB(RGB)](./color-helpers.lin_srgb.md)


</td><td>

Convert an array of of sRGB values where in-gamut values are in the range \[0 - 1\] to linear light (un-companded) form. Extended transfer function: For negative values, linear portion is extended on reflection of axis, then reflected power function is used.


</td></tr>
<tr><td>

[mapGamut(startOKLCH, toDestination, fromDestination)](./color-helpers.mapgamut.md)


</td><td>


</td></tr>
<tr><td>

[mapGamutRayTrace(startOKLCH, toLinear, fromLinear)](./color-helpers.mapgamutraytrace.md)


</td><td>


</td></tr>
<tr><td>

[OKLab\_to\_OKLCH(OKLab)](./color-helpers.oklab_to_oklch.md)


</td><td>


</td></tr>
<tr><td>

[OKLab\_to\_XYZ\_D50(x)](./color-helpers.oklab_to_xyz_d50.md)


</td><td>


</td></tr>
<tr><td>

[OKLab\_to\_XYZ(OKLab)](./color-helpers.oklab_to_xyz.md)


</td><td>

Given OKLab, convert to XYZ relative to D65


</td></tr>
<tr><td>

[OKLCH\_to\_OKLab(OKLCH)](./color-helpers.oklch_to_oklab.md)


</td><td>


</td></tr>
<tr><td>

[OKLCH\_to\_XYZ\_D50(x)](./color-helpers.oklch_to_xyz_d50.md)


</td><td>


</td></tr>
<tr><td>

[P3\_to\_XYZ\_D50(x)](./color-helpers.p3_to_xyz_d50.md)


</td><td>


</td></tr>
<tr><td>

[ProPhoto\_RGB\_to\_XYZ\_D50(x)](./color-helpers.prophoto_rgb_to_xyz_d50.md)


</td><td>


</td></tr>
<tr><td>

[rec\_2020\_to\_XYZ\_D50(x)](./color-helpers.rec_2020_to_xyz_d50.md)


</td><td>


</td></tr>
<tr><td>

[sRGB\_to\_XYZ\_D50(x)](./color-helpers.srgb_to_xyz_d50.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_D50\_to\_a98\_RGB(x)](./color-helpers.xyz_d50_to_a98_rgb.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_D50\_to\_HSL(x)](./color-helpers.xyz_d50_to_hsl.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_D50\_to\_HWB(x)](./color-helpers.xyz_d50_to_hwb.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_D50\_to\_Lab(x)](./color-helpers.xyz_d50_to_lab.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_D50\_to\_LCH(x)](./color-helpers.xyz_d50_to_lch.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_D50\_to\_lin\_P3(x)](./color-helpers.xyz_d50_to_lin_p3.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_D50\_to\_lin\_sRGB(x)](./color-helpers.xyz_d50_to_lin_srgb.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_D50\_to\_OKLab(x)](./color-helpers.xyz_d50_to_oklab.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_D50\_to\_OKLCH(x)](./color-helpers.xyz_d50_to_oklch.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_D50\_to\_P3(x)](./color-helpers.xyz_d50_to_p3.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_D50\_to\_ProPhoto(x)](./color-helpers.xyz_d50_to_prophoto.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_D50\_to\_rec\_2020(x)](./color-helpers.xyz_d50_to_rec_2020.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_D50\_to\_sRGB(x)](./color-helpers.xyz_d50_to_srgb.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_D50\_to\_XYZ\_D50(x)](./color-helpers.xyz_d50_to_xyz_d50.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_D50\_to\_XYZ\_D65(x)](./color-helpers.xyz_d50_to_xyz_d65.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_D65\_to\_XYZ\_D50(x)](./color-helpers.xyz_d65_to_xyz_d50.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_to\_lin\_P3(XYZ)](./color-helpers.xyz_to_lin_p3.md)


</td><td>

Convert XYZ to linear-light P3


</td></tr>
<tr><td>

[XYZ\_to\_lin\_sRGB(XYZ)](./color-helpers.xyz_to_lin_srgb.md)


</td><td>


</td></tr>
<tr><td>

[XYZ\_to\_OKLab(XYZ)](./color-helpers.xyz_to_oklab.md)


</td><td>


</td></tr>
</tbody></table>

## Variables

<table><thead><tr><th>

Variable


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[namedColors](./color-helpers.namedcolors.md)


</td><td>


</td></tr>
</tbody></table>

## Type Aliases

<table><thead><tr><th>

Type Alias


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[Color](./color-helpers.color.md)


</td><td>


</td></tr>
</tbody></table>

