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

Function applyColorMatrix

src/generators/utils/matrix.ts:26–30  ·  view source on GitHub ↗
([r, g, b]: [number, number, number], matrix: Matrix5x5)

Source from the content-addressed store, hash-verified

24}
25
26export function applyColorMatrix([r, g, b]: [number, number, number], matrix: Matrix5x5): [number, number, number] {
27 const rgb: Matrix5x1 = [[r / 255], [g / 255], [b / 255], [1], [1]];
28 const result = multiplyMatrices<Matrix5x1>(matrix, rgb);
29 return [0, 1, 2].map((i) => clamp(Math.round(result[i][0] * 255), 0, 255)) as [number, number, number];
30}
31
32export const Matrix = {
33

Callers 3

modifyColorWithCacheFunction · 0.90
createStaticStylesheetFunction · 0.90

Calls 2

multiplyMatricesFunction · 0.90
clampFunction · 0.90

Tested by

no test coverage detected