Added listener styles in theme switching

locals-and-roots
nicolas-p 2016-05-06 11:31:29 +02:00 committed by John Benediktsson
parent a83c90d849
commit f650f7d869
3 changed files with 19 additions and 11 deletions

View File

@ -28,7 +28,6 @@ SYNTAX: TIP:
: a-tip ( -- tip ) tips get random ;
SYMBOL: tip-of-the-day-style
H{
{ page-color $ tip-background-color }
{ inset { 5 5 } }

View File

@ -1,7 +1,7 @@
! Copyright (C) 2016 Nicolas Pénet.
! See http://factorcode.org/license.txt for BSD license.
USING: fry hashtables help.stylesheet help.tips io.styles
kernel listener namespaces ui.gadgets.theme ;
kernel listener namespaces ui.gadgets.theme ui.tools.listener ;
IN: ui.gadgets.theme.switching
: (update-style) ( style color elt -- )
@ -21,7 +21,9 @@ IN: ui.gadgets.theme.switching
table-style line-color table-border (update-style)
prompt-style prompt-background-color background (update-style)
prompt-style text-color foreground (update-style)
tip-of-the-day-style tip-background-color page-color (update-style) ;
tip-of-the-day-style tip-background-color page-color (update-style)
listener-input-style text-color foreground (update-style)
listener-word-style text-color foreground (update-style) ;
: light-mode ( -- ) light-theme theme set-global update-stylesheet ;
: dark-mode ( -- ) dark-theme theme set-global update-stylesheet ;

View File

@ -95,19 +95,26 @@ M: interactor stream-element-type drop +character+ ;
GENERIC: (print-input) ( object -- )
SYMBOL: listener-input-style
H{
{ font-style bold }
{ foreground $ text-color }
} listener-input-style set-global
SYMBOL: listener-word-style
H{
{ font-name "sans-serif" }
{ font-style bold }
{ foreground $ text-color }
} listener-word-style set-global
M: input (print-input)
dup presented associate [
string>>
H{ { font-style bold } { foreground $ text-color } }
format
string>> listener-input-style get-global format
] with-nesting nl ;
M: word (print-input)
"Command: "
H{ { font-name "sans-serif" }
{ font-style bold }
{ foreground $ text-color }
} format . ;
"Command: " listener-word-style get-global format . ;
: print-input ( object interactor -- )
output>> [ (print-input) ] with-output-stream* ;