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

Function getEmbeddedSVGFilterValue

src/generators/svg-filter.ts:23–33  ·  view source on GitHub ↗
(matrixValue: string)

Source from the content-addressed store, hash-verified

21}
22
23function getEmbeddedSVGFilterValue(matrixValue: string): string {
24 const id = 'dark-reader-filter';
25 const svg = [
26 '<svg xmlns="http://www.w3.org/2000/svg">',
27 `<filter id="${id}" style="color-interpolation-filters: sRGB;">`,
28 `<feColorMatrix type="matrix" values="${matrixValue}" />`,
29 '</filter>',
30 '</svg>',
31 ].join('');
32 return `url(data:image/svg+xml;base64,${btoa(svg)}#${id})`;
33}
34
35function toSVGMatrix(matrix: number[][]): string {
36 return matrix.slice(0, 4).map((m) => m.map((m) => m.toFixed(3)).join(' ')).join(' ');

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected