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

Function rgbToHexString

src/utils/color.ts:136–140  ·  view source on GitHub ↗
({r, g, b, a}: RGBA)

Source from the content-addressed store, hash-verified

134}
135
136export function rgbToHexString({r, g, b, a}: RGBA): string {
137 return `#${(a != null && a < 1 ? [r, g, b, Math.round(a * 255)] : [r, g, b]).map((x) => {
138 return `${x < 16 ? '0' : ''}${x.toString(16)}`;
139 }).join('')}`;
140}
141
142export function hslToString(hsl: HSLA): string {
143 const {h, s, l, a} = hsl;

Callers 6

getRegisteredColorFunction · 0.90
registerColorFunction · 0.90
modifyColorWithCacheFunction · 0.90
hsbToStringFunction · 0.90
HSBPickerFunction · 0.90
color.tests.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected