|
| 1 | +import restoreTheme from "lib/restoreTheme"; |
| 2 | +import appSettings from "lib/settings"; |
| 3 | +import { isDeviceDarkTheme } from "lib/systemConfiguration"; |
| 4 | +import color from "utils/color"; |
1 | 5 | import { createBuiltInTheme } from "./builder"; |
| 6 | +import { apply, update } from "./list"; |
2 | 7 |
|
3 | 8 | const WHITE = "rgb(255, 255, 255)"; |
4 | 9 | const BLACK = "rgb(0, 0, 0)"; |
@@ -164,10 +169,68 @@ light.linkTextColor = "rgb(104, 103, 149)"; |
164 | 169 | light.borderColor = "rgb(153, 153, 153)"; |
165 | 170 | light.popupIconColor = "rgb(51, 62, 89)"; |
166 | 171 |
|
| 172 | +const system = createBuiltInTheme("System"); |
| 173 | + |
| 174 | +export function getSystemEditorTheme(darkTheme) { |
| 175 | + if (darkTheme) { |
| 176 | + return "ace/theme/clouds_midnight"; |
| 177 | + } else { |
| 178 | + return "ace/theme/crimson_editor"; |
| 179 | + } |
| 180 | +} |
| 181 | + |
| 182 | +export function updateSystemTheme(darkTheme) { |
| 183 | + if (darkTheme) { |
| 184 | + system.primaryColor = "rgb(49, 49, 49)"; |
| 185 | + system.primaryTextColor = WHITE; |
| 186 | + system.darkenedPrimaryColor = "rgb(29, 29, 29)"; |
| 187 | + system.secondaryColor = "rgb(37, 37, 37)"; |
| 188 | + system.secondaryTextColor = WHITE; |
| 189 | + system.activeColor = "rgb(51, 153, 255)"; |
| 190 | + system.linkTextColor = "rgb(181, 180, 233)"; |
| 191 | + system.borderColor = "rgba(230, 230, 230, 0.2)"; |
| 192 | + system.popupIconColor = WHITE; |
| 193 | + |
| 194 | + system.popupBackgroundColor = "rgb(49, 49, 49)"; |
| 195 | + system.popupTextColor = WHITE; |
| 196 | + system.popupActiveColor = "rgb(255, 215, 0)"; |
| 197 | + system.type = "dark"; |
| 198 | + } else { |
| 199 | + system.type = "light"; |
| 200 | + system.darkenedPrimaryColor = "rgb(153, 153, 153)"; |
| 201 | + system.primaryColor = WHITE; |
| 202 | + system.primaryTextColor = "rgb(51, 62, 89)"; |
| 203 | + system.secondaryColor = WHITE; |
| 204 | + system.secondaryTextColor = "rgb(51, 62, 89)"; |
| 205 | + system.activeColor = "rgb(51, 153, 255)"; |
| 206 | + system.linkTextColor = BLACK; |
| 207 | + system.borderColor = "rgb(153, 153, 153)"; |
| 208 | + system.popupIconColor = "rgb(51, 62, 89)"; |
| 209 | + |
| 210 | + system.popupBackgroundColor = WHITE; |
| 211 | + system.popupTextColor = BLACK; |
| 212 | + system.popupActiveColor = "rgb(255, 215, 0)"; |
| 213 | + } |
| 214 | + |
| 215 | + system.preferredEditorTheme = getSystemEditorTheme(darkTheme); |
| 216 | + |
| 217 | + if ( |
| 218 | + appSettings !== undefined && |
| 219 | + appSettings.value !== undefined && |
| 220 | + appSettings.value.appTheme !== undefined && |
| 221 | + appSettings.value.appTheme.toLowerCase() === "system" |
| 222 | + ) { |
| 223 | + apply(system.id, true); |
| 224 | + } |
| 225 | +} |
| 226 | + |
| 227 | +updateSystemTheme(isDeviceDarkTheme()); |
| 228 | + |
167 | 229 | const custom = createBuiltInTheme("Custom"); |
168 | 230 | custom.autoDarkened = true; |
169 | 231 |
|
170 | 232 | export default [ |
| 233 | + system, |
171 | 234 | createBuiltInTheme("default", "dark", "free"), |
172 | 235 | dark, |
173 | 236 | oled, |
|
0 commit comments