(theme: Theme)
| 70 | }; |
| 71 | |
| 72 | export function setWindowTheme(theme: Theme): void { |
| 73 | const colors = Object.entries($colors).reduce((obj: { [key: string]: string }, [key, value]) => { |
| 74 | const type: 'bg' | 'text' | 'border' = themeColorTypes[key]; |
| 75 | const modify: ((rgb: RGBA, theme: Theme, shouldRegister: boolean) => string) = { |
| 76 | 'bg': modifyBackgroundColor, |
| 77 | 'text': modifyForegroundColor, |
| 78 | 'border': modifyBorderColor, |
| 79 | }[type]; |
| 80 | const rgb = parseColorWithCache(value)!; |
| 81 | const modified = modify(rgb, theme, false); |
| 82 | obj[key] = modified; |
| 83 | return obj; |
| 84 | }, {}); |
| 85 | if (typeof browser !== 'undefined' && browser.theme && browser.theme.update) { |
| 86 | browser.theme.update({colors}); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | export function resetWindowTheme(): void { |
| 91 | if (typeof browser !== 'undefined' && browser.theme && browser.theme.reset) { |
no test coverage detected