MCPcopy
hub / github.com/GitbookIO/gitbook / getColor

Function getColor

packages/colors/src/transformations.ts:298–304  ·  view source on GitHub ↗
(percentage: number, start: RGBColor, end: RGBColor)

Source from the content-addressed store, hash-verified

296}
297
298export function getColor(percentage: number, start: RGBColor, end: RGBColor) {
299 const rgb = end.map((channel, index) => {
300 return Math.round(channel + percentage * (start[index]! - channel));
301 });
302
303 return rgbArrayToHex(rgb as RGBColor);
304}
305
306// Utility constants and helper functions
307export function rgbToLinear(rgb: RGBColor): [number, number, number] {

Callers 1

shadesOfColorFunction · 0.85

Calls 1

rgbArrayToHexFunction · 0.85

Tested by

no test coverage detected