MCPcopy Create free account
hub / github.com/ChartGPU/ChartGPU / rgba01ToCssRgba

Function rgba01ToCssRgba

src/core/createRenderCoordinator.ts:567–573  ·  view source on GitHub ↗
(rgba: readonly [number, number, number, number])

Source from the content-addressed store, hash-verified

565};
566
567const rgba01ToCssRgba = (rgba: readonly [number, number, number, number]): string => {
568 const r = Math.max(0, Math.min(255, Math.round(rgba[0] * 255)));
569 const g = Math.max(0, Math.min(255, Math.round(rgba[1] * 255)));
570 const b = Math.max(0, Math.min(255, Math.round(rgba[2] * 255)));
571 const a = Math.max(0, Math.min(1, rgba[3]));
572 return `rgba(${r},${g},${b},${a})`;
573};
574
575const withAlpha = (cssColor: string, alphaMultiplier: number): string => {
576 const parsed = parseCssColorToRgba01(cssColor);

Callers 1

withAlphaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected