]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/ui/theme/switching/switching.factor
Add Wombat theme, put it and Base16 theme in OS X menu
[factor.git] / basis / ui / theme / switching / switching.factor
index 282fc33a2c8fc862318882b9f916d7a9081971e4..2e68a99911a5fe01491d1f682aedb790fac3c737 100644 (file)
@@ -1,66 +1,33 @@
 ! Copyright (C) 2016 Nicolas PĂ©net.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: assocs fonts fry hashtables help.stylesheet help.tips
-io.styles kernel listener namespaces prettyprint.stylesheet
-sequences ui.theme ui.tools.listener vocabs.prettyprint words ;
+USING: hashtables kernel namespaces sequences ui.theme ui.theme.base16
+ui.theme.wombat vocabs.loader ;
 IN: ui.theme.switching
 
-<PRIVATE
+SYMBOL: default-theme?
+t default-theme? set-global
 
 : 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
+    \ update-stylesheet get [ execute( -- ) ] each ;
 
-    ! 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 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
-    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
+: switch-theme ( theme -- )
+    theme set-global update-stylesheet
+    f default-theme? set-global ;
 
-    ! listener
-    prompt-style prompt-background-color background update-style
-    prompt-style text-color foreground update-style
+: switch-theme-if-default ( theme -- )
+    default-theme? get [
+        switch-theme t default-theme? set-global
+    ] [ drop ] if ;
 
-    ! vocabs.prettyprint
-    manifest-style vocab-background-color page-color update-style
-    manifest-style vocab-border-color border-color update-style ;
+: light-mode ( -- ) light-theme switch-theme ;
 
-PRIVATE>
+: dark-mode ( -- ) dark-theme switch-theme ;
 
-: switch-theme ( theme -- )
-    theme set-global update-stylesheet ;
+: wombat-mode ( -- ) wombat-theme switch-theme ;
 
-: light-mode ( -- ) light-theme switch-theme ;
+: base16-mode ( -- ) base16-theme switch-theme ;
 
-: dark-mode ( -- ) dark-theme switch-theme ;
+{ "ui.theme.switching" "ui.tools" } "ui.theme.switching.tools" require-when