MCPcopy Index your code
hub / github.com/darkreader/darkreader / hslToString

Function hslToString

src/utils/color.ts:142–148  ·  view source on GitHub ↗
(hsl: HSLA)

Source from the content-addressed store, hash-verified

140}
141
142export function hslToString(hsl: HSLA): string {
143 const {h, s, l, a} = hsl;
144 if (a != null && a < 1) {
145 return `hsla(${toFixed(h)}, ${toFixed(s * 100)}%, ${toFixed(l * 100)}%, ${toFixed(a, 2)})`;
146 }
147 return `hsl(${toFixed(h)}, ${toFixed(s * 100)}%, ${toFixed(l * 100)}%)`;
148}
149
150const rgbMatch = /^rgba?\([^\(\)]+\)$/;
151const hslMatch = /^hsla?\([^\(\)]+\)$/;

Callers 3

HSBPickerFunction · 0.90
color.tests.tsFile · 0.90

Calls 1

toFixedFunction · 0.85

Tested by

no test coverage detected