From f650f7d8690fbda692229ece59b32424391e0964 Mon Sep 17 00:00:00 2001 From: nicolas-p Date: Fri, 6 May 2016 11:31:29 +0200 Subject: [PATCH] Added listener styles in theme switching --- basis/help/tips/tips.factor | 1 - .../gadgets/theme/switching/switching.factor | 6 +++-- basis/ui/tools/listener/listener.factor | 23 ++++++++++++------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/basis/help/tips/tips.factor b/basis/help/tips/tips.factor index 8fa876a96c..7e6d40d7e9 100644 --- a/basis/help/tips/tips.factor +++ b/basis/help/tips/tips.factor @@ -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 } } diff --git a/basis/ui/gadgets/theme/switching/switching.factor b/basis/ui/gadgets/theme/switching/switching.factor index 2a4918bb9e..8fb37d5624 100644 --- a/basis/ui/gadgets/theme/switching/switching.factor +++ b/basis/ui/gadgets/theme/switching/switching.factor @@ -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 ; diff --git a/basis/ui/tools/listener/listener.factor b/basis/ui/tools/listener/listener.factor index 6b217c327e..1aaf99f693 100644 --- a/basis/ui/tools/listener/listener.factor +++ b/basis/ui/tools/listener/listener.factor @@ -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* ;