* * @param {ThemeBuilder} theme * @returns
(theme)
| 56 | * @returns |
| 57 | */ |
| 58 | function add(theme) { |
| 59 | if (!(theme instanceof ThemeBuilder)) return; |
| 60 | if (appThemes.has(theme.id)) return; |
| 61 | |
| 62 | appThemes.set(theme.id, theme); |
| 63 | |
| 64 | const { appTheme } = settings.value; |
| 65 | |
| 66 | if (theme.matches(appTheme)) { |
| 67 | if (appTheme !== "system") { |
| 68 | apply(appTheme); |
| 69 | } else { |
| 70 | updateSystemTheme(isDeviceDarkTheme()); |
| 71 | themeApplied = true; |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Apply a theme |
no test coverage detected