]> gitweb.factorcode.org Git - factor.git/commitdiff
ui.theme.switching: split out ui.tools themeing
authorJohn Benediktsson <mrjbq7@gmail.com>
Sat, 5 Mar 2022 15:01:23 +0000 (07:01 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sat, 5 Mar 2022 15:01:23 +0000 (07:01 -0800)
basis/ui/theme/switching/switching.factor
basis/ui/theme/switching/tools/tools.factor [new file with mode: 0644]

index 2ae5aa5eaa571eec97835e70c401a4457b2a32cd..9b22efc3637c16c2320d0318ce402f5b6599c13e 100644 (file)
@@ -1,71 +1,17 @@
 ! Copyright (C) 2016 Nicolas PĂ©net.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: assocs fonts hashtables help.stylesheet help.tips
-io.styles kernel listener memoize namespaces
-prettyprint.stylesheet sequences ui.gadgets.panes.private
-ui.theme ui.tools.listener vocabs.prettyprint words ;
+USING: hashtables kernel namespaces sequences ui.theme
+vocabs.loader ;
 IN: ui.theme.switching
 
 SYMBOL: default-theme?
 t default-theme? set-global
 
-<PRIVATE
-
 : update-style ( style color elt -- )
     '[ _ _ rot ?set-at ] change-global ;
 
 : update-stylesheet ( -- )
-    ! fonts
-    text-color default-font-foreground-color set-global
-    content-background default-font-background-color set-global
-
-    ! ui.gadgets.panes
-    \ specified-font reset-memoized
-
-    ! help.stylesheet
-    default-style text-color foreground update-style
-    link-style link-color foreground update-style
-    title-style title-color foreground update-style
-    title-style help-header-background page-color update-style
-    help-path-style text-color foreground update-style
-    help-path-style help-path-border-color table-border update-style
-    heading-style heading-color foreground update-style
-    snippet-style snippet-color foreground update-style
-    code-style code-background-color page-color update-style
-    code-style text-color foreground update-style
-    output-style output-color foreground update-style
-    url-style link-color foreground update-style
-    warning-style warning-background-color page-color update-style
-    warning-style warning-border-color border-color update-style
-    deprecated-style deprecated-background-color page-color update-style
-    deprecated-style deprecated-border-color border-color update-style
-    table-style table-border-color table-border update-style
-
-    ! help.tips
-    tip-of-the-day-style tip-background-color page-color update-style
-
-    ! ui.tools.listener
-    listener-input-style text-color foreground update-style
-    listener-word-style text-color foreground update-style
-
-    ! prettyprint.stylesheet
-    { POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: }
-    [ "word-style" word-prop [ dim-color foreground  ] dip set-at ] each
-    base-word-style text-color foreground update-style
-    highlighted-word-style highlighted-word-color foreground update-style
-    base-string-style string-color foreground update-style
-    base-vocab-style dim-color foreground update-style
-    base-effect-style stack-effect-color foreground update-style
-
-    ! listener
-    prompt-style prompt-background-color background update-style
-    prompt-style text-color foreground update-style
-
-    ! vocabs.prettyprint
-    manifest-style vocab-background-color page-color update-style
-    manifest-style vocab-border-color border-color update-style ;
-
-PRIVATE>
+    \ update-stylesheet get [ execute( -- ) ] each ;
 
 : switch-theme ( theme -- )
     theme set-global update-stylesheet
@@ -79,3 +25,5 @@ PRIVATE>
 : light-mode ( -- ) light-theme switch-theme ;
 
 : dark-mode ( -- ) dark-theme switch-theme ;
+
+{ "ui.theme.switching" "ui.tools" } "ui.theme.switching.tools" require-when
diff --git a/basis/ui/theme/switching/tools/tools.factor b/basis/ui/theme/switching/tools/tools.factor
new file mode 100644 (file)
index 0000000..1a56b83
--- /dev/null
@@ -0,0 +1,58 @@
+USING: assocs fonts help.stylesheet help.tips io.styles kernel
+listener memoize namespaces prettyprint.stylesheet sequences
+ui.gadgets.panes.private ui.theme ui.theme.switching
+ui.tools.listener vectors vocabs.prettyprint words ;
+IN: ui.theme.switching.tools
+
+: update-tools-style ( -- )
+    ! fonts
+    text-color default-font-foreground-color set-global
+    content-background default-font-background-color set-global
+
+    ! help.stylesheet
+    default-style text-color foreground update-style
+    link-style link-color foreground update-style
+    title-style title-color foreground update-style
+    title-style help-header-background page-color update-style
+    help-path-style text-color foreground update-style
+    help-path-style help-path-border-color table-border update-style
+    heading-style heading-color foreground update-style
+    snippet-style snippet-color foreground update-style
+    code-style code-background-color page-color update-style
+    code-style text-color foreground update-style
+    output-style output-color foreground update-style
+    url-style link-color foreground update-style
+    warning-style warning-background-color page-color update-style
+    warning-style warning-border-color border-color update-style
+    deprecated-style deprecated-background-color page-color update-style
+    deprecated-style deprecated-border-color border-color update-style
+    table-style table-border-color table-border update-style
+
+    ! help.tips
+    tip-of-the-day-style tip-background-color page-color update-style
+
+    ! prettyprint.stylesheet
+    { POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: }
+    [ "word-style" word-prop [ dim-color foreground  ] dip set-at ] each
+    base-word-style text-color foreground update-style
+    highlighted-word-style highlighted-word-color foreground update-style
+    base-string-style string-color foreground update-style
+    base-vocab-style dim-color foreground update-style
+    base-effect-style stack-effect-color foreground update-style
+
+    ! vocabs.prettyprint
+    manifest-style vocab-background-color page-color update-style
+    manifest-style vocab-border-color border-color update-style
+
+    ! ui.gadgets.panes
+    \ specified-font reset-memoized
+
+    ! ui.tools.listener
+    listener-input-style text-color foreground update-style
+    listener-word-style text-color foreground update-style
+
+    ! listener
+    prompt-style prompt-background-color background update-style
+    prompt-style text-color foreground update-style ;
+
+\ update-stylesheet [ \ update-tools-style swap ?push ] change-global