|
43 | 43 |
|
44 | 44 | (preferences:set-default 'framework:ascii-art-enlarge #f boolean?) |
45 | 45 |
|
46 | | -;; the name of the color scheme that the user prefers when in black-on-white mode |
47 | | -(preferences:set-default 'framework:color-scheme |
48 | | - 'classic |
49 | | - symbol?) |
50 | | -;; the name of the color scheme that the user prefers when in white-on-black mode |
51 | | -(preferences:set-default 'framework:color-scheme-wob |
52 | | - 'white-on-black |
53 | | - symbol?) |
54 | | - |
55 | 46 | (preferences:set-default 'framework:column-guide-width |
56 | 47 | '(#f 102) |
57 | 48 | (list/c boolean? (and/c exact-integer? (>=/c 2)))) |
|
229 | 220 |
|
230 | 221 | (set-square-bracket-nonum-pref 'framework:square-bracket:for/fold for/folds) |
231 | 222 |
|
| 223 | +;; this preference shouldn't be used any more; we keep it here |
| 224 | +;; only so we can access it's old value |
| 225 | +(preferences:set-default 'framework:color-scheme 'classic symbol?) |
| 226 | + |
| 227 | +(define dark-mode-with-previous-preferences-organization? |
| 228 | + ;; all of the color schemes on the package server with |
| 229 | + ;; 'white-on-black-base? set to #t |
| 230 | + (and (member (preferences:get 'framework:color-scheme) |
| 231 | + '(white-on-black |
| 232 | + |Tol's White on Black| |
| 233 | + |Catppuccin Frappe| |
| 234 | + |Catppuccin Macchiato| |
| 235 | + |Catppuccin Mocha| |
| 236 | + |Dracula| |
| 237 | + |Cyberpunk| |
| 238 | + |Everforest Dark Hard| |
| 239 | + |Everforest Dark Medium| |
| 240 | + |Everforest Dark Low| |
| 241 | + |Material| |
| 242 | + |One Dark| |
| 243 | + |Dark Green - blue style| |
| 244 | + |Dark Green - orange style| |
| 245 | + |Solarized Dark| |
| 246 | + |Sonokai| |
| 247 | + |fairyfloss| |
| 248 | + |Funktionuckelt Dark| |
| 249 | + |
| 250 | + ;; these two have a #f set in the info.rkt file, but |
| 251 | + ;; seems to actually intended to be dark color schemes |
| 252 | + |ayu mirage| |
| 253 | + |Zenburn| |
| 254 | + )) |
| 255 | + #t)) |
| 256 | + |
| 257 | +;; the name of the color scheme that the user prefers when in black-on-white mode |
| 258 | +;; the default is based on the previous preferences organization, preserving the |
| 259 | +;; chosen preference if we can. |
| 260 | +(preferences:set-default 'framework:color-scheme-light |
| 261 | + (if dark-mode-with-previous-preferences-organization? |
| 262 | + 'classic |
| 263 | + (preferences:get 'framework:color-scheme)) |
| 264 | + symbol?) |
| 265 | +;; the name of the color scheme that the user prefers when in white-on-black mode |
| 266 | +(preferences:set-default 'framework:color-scheme-dark |
| 267 | + (if dark-mode-with-previous-preferences-organization? |
| 268 | + (preferences:get 'framework:color-scheme) |
| 269 | + 'white-on-black) |
| 270 | + symbol?) |
| 271 | + |
| 272 | + |
232 | 273 | ;; either: |
233 | | -;; #t (meaning we always treat it as white-on-black mode) |
234 | | -;; #f (meaning we always treat it as black-on-white mode), or |
| 274 | +;; #t (meaning we always treat it as white-on-black aka dark mode) |
| 275 | +;; #f (meaning we always treat it as black-on-white aka light mode), or |
235 | 276 | ;; 'platform (meaning we use `white-on-black-panel-scheme?` to determine what to do) |
236 | 277 | (preferences:set-default 'framework:white-on-black-mode? |
| 278 | + ;; in the past, the 'framework:color-scheme preference |
| 279 | + ;; determined a single color scheme; use that scheme's |
| 280 | + ;; dark/light mode category to determine the default |
| 281 | + ;; preference for this preference, preferring 'platform |
| 282 | + ;; if 'platform seems to make sense |
237 | 283 | (case (system-type) |
238 | | - [(windows) #f] |
239 | | - [else 'platform]) |
| 284 | + [(windows) |
| 285 | + dark-mode-with-previous-preferences-organization?] |
| 286 | + [else |
| 287 | + (cond |
| 288 | + [(equal? dark-mode-with-previous-preferences-organization? |
| 289 | + (white-on-black-panel-scheme?)) |
| 290 | + 'platform] |
| 291 | + [else dark-mode-with-previous-preferences-organization?])]) |
240 | 292 | (or/c boolean? 'platform)) |
241 | 293 |
|
242 | 294 | ;; this is an old setting that has been replaced with 'framework:white-on-black-mode? |
|
606 | 658 | 'platform) |
607 | 659 | (define pref |
608 | 660 | (if (white-on-black-panel-scheme?) |
609 | | - 'framework:color-scheme-wob |
610 | | - 'framework:color-scheme)) |
| 661 | + 'framework:color-scheme-dark |
| 662 | + 'framework:color-scheme-light)) |
611 | 663 | (define scheme-name (preferences:get pref)) |
612 | 664 | (color-prefs:change-colors-to-match-color-scheme |
613 | 665 | (or (color-prefs:lookup-color-scheme scheme-name) |
|
616 | 668 | (color-prefs:built-in-color-scheme))))))) |
617 | 669 |
|
618 | 670 | (preferences:add-callback |
619 | | - 'framework:color-scheme |
| 671 | + 'framework:color-scheme-light |
620 | 672 | (λ (sym val) |
621 | 673 | (unless (color-prefs:white-on-black-color-scheme?) |
622 | 674 | (color-prefs:change-colors-to-match-color-scheme |
623 | 675 | (or (color-prefs:lookup-color-scheme val) |
624 | 676 | (color-prefs:built-in-color-scheme)))))) |
625 | 677 |
|
626 | 678 | (preferences:add-callback |
627 | | - 'framework:color-scheme-wob |
| 679 | + 'framework:color-scheme-dark |
628 | 680 | (λ (sym val) |
629 | 681 | (when (color-prefs:white-on-black-color-scheme?) |
630 | 682 | (color-prefs:change-colors-to-match-color-scheme |
|
639 | 691 | ['platform (white-on-black-panel-scheme?)] |
640 | 692 | [#t #t] |
641 | 693 | [#f #f])) |
642 | | - (define pref-name (if wob? 'framework:color-scheme-wob 'framework:color-scheme)) |
| 694 | + (define pref-name (if wob? 'framework:color-scheme-dark 'framework:color-scheme-light)) |
643 | 695 | (define pref-val (preferences:get pref-name)) |
644 | 696 | (define found-color-scheme (color-prefs:lookup-color-scheme pref-val)) |
645 | 697 | (color-prefs:change-colors-to-match-color-scheme |
|
0 commit comments