(matrixValue: string)
| 21 | } |
| 22 | |
| 23 | function 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 | |
| 35 | function toSVGMatrix(matrix: number[][]): string { |
| 36 | return matrix.slice(0, 4).map((m) => m.map((m) => m.toFixed(3)).join(' ')).join(' '); |
no outgoing calls
no test coverage detected