(theme: Theme, {strict}: {strict: boolean})
| 249 | type FallbackFactory = (theme: Theme, options: {strict: boolean}) => string; |
| 250 | |
| 251 | function defaultFallbackFactory(theme: Theme, {strict}: {strict: boolean}): string { |
| 252 | const lines: string[] = []; |
| 253 | lines.push(`html, body, ${strict ? 'body :not(iframe)' : 'body > :not(iframe)'} {`); |
| 254 | lines.push(` background-color: ${modifyBackgroundColor({r: 255, g: 255, b: 255}, theme)} !important;`); |
| 255 | lines.push(` border-color: ${modifyBorderColor({r: 64, g: 64, b: 64}, theme)} !important;`); |
| 256 | lines.push(` color: ${modifyForegroundColor({r: 0, g: 0, b: 0}, theme)} !important;`); |
| 257 | lines.push('}'); |
| 258 | // MS Learn High Contrast issue |
| 259 | // https://github.com/darkreader/darkreader/issues/3618 |
| 260 | lines.push(`div[style*="background-color: rgb(135, 135, 135)"] {`); |
| 261 | lines.push(` background-color: #878787 !important;`); |
| 262 | lines.push('}'); |
| 263 | return lines.join('\n'); |
| 264 | } |
| 265 | |
| 266 | let fallbackFactory: FallbackFactory | null = null; |
| 267 |
nothing calls this directly
no test coverage detected