()
| 170 | } |
| 171 | |
| 172 | function renderTerminalThemes() { |
| 173 | destroyPreview("switch-tab"); |
| 174 | $themePreview.innerHTML = ""; |
| 175 | const currentTheme = appSettings.value.terminalSettings?.theme || "dark"; |
| 176 | |
| 177 | if (innerHeight * 0.3 >= 120) { |
| 178 | if (!$themePreview.parentElement) { |
| 179 | $page.body.append($themePreview); |
| 180 | } |
| 181 | createTerminalPreview(currentTheme); |
| 182 | } else { |
| 183 | $themePreview.remove(); |
| 184 | } |
| 185 | |
| 186 | const themeNames = TerminalThemeManager.getThemeNames(); |
| 187 | let $currentItem; |
| 188 | list.el.content = themeNames.map((name) => { |
| 189 | const isCurrent = name === currentTheme; |
| 190 | const themeObj = TerminalThemeManager.getTheme(name); |
| 191 | const label = name.charAt(0).toUpperCase() + name.slice(1); |
| 192 | const $item = ( |
| 193 | <Item |
| 194 | name={label} |
| 195 | isCurrent={isCurrent} |
| 196 | swatches={[themeObj.background, themeObj.foreground, themeObj.cursor]} |
| 197 | onclick={() => setTerminalTheme(name)} |
| 198 | /> |
| 199 | ); |
| 200 | if (isCurrent) $currentItem = $item; |
| 201 | return $item; |
| 202 | }); |
| 203 | $currentItem?.scrollIntoView(); |
| 204 | } |
| 205 | |
| 206 | function setTerminalTheme(name) { |
| 207 | if (appSettings.value.appTheme?.toLowerCase() === "system") { |
nothing calls this directly
no test coverage detected