MCPcopy Create free account
hub / github.com/bytebase/bytebase / rgbToHex

Function rgbToHex

frontend/src/utils/css.ts:14–19  ·  view source on GitHub ↗
(r: number, g: number, b: number)

Source from the content-addressed store, hash-verified

12} as const;
13
14export const rgbToHex = (r: number, g: number, b: number) => {
15 const hex = [r, g, b]
16 .map((decimal) => decimal.toString(16).padStart(2, "0"))
17 .join("");
18 return `#${hex}`;
19};
20
21export const hexToRgb = (hex: string) => {
22 hex = hex.replace(/^#/, "");

Callers 2

colorToHexFunction · 0.85
callCssVariableFunction · 0.85

Calls 1

toStringMethod · 0.65

Tested by

no test coverage detected