MCPcopy Create free account
hub / github.com/darkreader/darkreader / createMatrixFilter

Function createMatrixFilter

src/inject/svg-filter.ts:8–21  ·  view source on GitHub ↗
(id: string, matrix: string)

Source from the content-addressed store, hash-verified

6 createNode: (target) => {
7 const SVG_NS = 'http://www.w3.org/2000/svg';
8 const createMatrixFilter = (id: string, matrix: string) => {
9 const filter = document.createElementNS(SVG_NS, 'filter');
10 filter.id = id;
11 filter.style.colorInterpolationFilters = 'sRGB';
12
13 // Fix displaying dynamic content https://bugs.chromium.org/p/chromium/issues/detail?id=647437
14 filter.setAttribute('x', '0');
15 filter.setAttribute('y', '0');
16 filter.setAttribute('width', '99999');
17 filter.setAttribute('height', '99999');
18
19 filter.appendChild(createColorMatrix(matrix));
20 return filter;
21 };
22
23 const createColorMatrix = (matrix: string) => {
24 const colorMatrix = document.createElementNS(SVG_NS, 'feColorMatrix');

Callers 1

createOrUpdateSVGFilterFunction · 0.85

Calls 1

createColorMatrixFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…