MCPcopy Create free account
hub / github.com/arwes/arwes / fromArrayToRGB

Function fromArrayToRGB

packages/theme/src/createThemeColor/createThemeColor.ts:39–51  ·  view source on GitHub ↗
(
  src: [number, number, number, number?],
  options: ThemeColorOptions = colorOptionsDefault
)

Source from the content-addressed store, hash-verified

37}
38
39const fromArrayToRGB = (
40 src: [number, number, number, number?],
41 options: ThemeColorOptions = colorOptionsDefault
42): string => {
43 const [red, green, blue, alpha = 1] = src
44 const { alpha: alphaOverwrite = 1 } = options
45
46 const r = minMax0to100(red)
47 const g = minMax0to100(green)
48 const b = minMax0to100(blue)
49 const a = minMax0to1(alpha) * minMax0to1(alphaOverwrite)
50 return `rgb(${r}%,${g}%,${b}%,${a})`
51}
52
53const fromArrayToLCH = (
54 src: [number, number, number, number?],

Callers 2

createThemeColorBySeriesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected