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

Function createReverseRule

src/generators/css-filter.ts:155–179  ·  view source on GitHub ↗
(reverseFilterValue: string, fix: InversionFix)

Source from the content-addressed store, hash-verified

153}
154
155function createReverseRule(reverseFilterValue: string, fix: InversionFix): string {
156 const lines: string[] = [];
157
158 if (fix.invert.length > 0) {
159 lines.push(`${joinSelectors(fix.invert)} {`);
160 lines.push(` -webkit-filter: ${reverseFilterValue} !important;`);
161 lines.push(` filter: ${reverseFilterValue} !important;`);
162 lines.push('}');
163 }
164
165 if (fix.noinvert.length > 0) {
166 lines.push(`${joinSelectors(fix.noinvert)} {`);
167 lines.push(' -webkit-filter: none !important;');
168 lines.push(' filter: none !important;');
169 lines.push('}');
170 }
171
172 if (fix.removebg.length > 0) {
173 lines.push(`${joinSelectors(fix.removebg)} {`);
174 lines.push(' background: white !important;');
175 lines.push('}');
176 }
177
178 return lines.join('\n');
179}
180
181/**
182* Returns fixes for a given URL.

Callers 1

Calls 1

joinSelectorsFunction · 0.70

Tested by

no test coverage detected