From e5698281fb49b9ad248e101984270884c5a871d5 Mon Sep 17 00:00:00 2001 From: nicolas-p Date: Tue, 3 May 2016 19:27:03 +0200 Subject: [PATCH] Replaced hard-coded colors with constants --- basis/help/stylesheet/stylesheet.factor | 25 ++++++++----------- basis/help/tips/tips.factor | 6 ++--- basis/listener/listener.factor | 11 ++++---- .../prettyprint/stylesheet/stylesheet.factor | 12 ++++----- basis/ui/gadgets/editors/editors.factor | 2 +- basis/ui/gadgets/labeled/labeled.factor | 4 +-- basis/ui/render/render.factor | 12 --------- basis/ui/tools/browser/popups/popups.factor | 2 +- .../listener/completion/completion.factor | 2 +- basis/vocabs/prettyprint/prettyprint.factor | 10 ++++---- 10 files changed, 35 insertions(+), 51 deletions(-) diff --git a/basis/help/stylesheet/stylesheet.factor b/basis/help/stylesheet/stylesheet.factor index e125b361f9..0b64ae07f2 100644 --- a/basis/help/stylesheet/stylesheet.factor +++ b/basis/help/stylesheet/stylesheet.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2005, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: assocs colors.constants fonts fry io.styles kernel literals -math namespaces sequences ; +math namespaces sequences ui.gadgets.theme ; IN: help.stylesheet : wrap-margin-full ( -- n ) @@ -36,7 +36,7 @@ H{ SYMBOL: link-style H{ - { foreground COLOR: DodgerBlue4 } + { foreground $ link-color } { font-style bold } } link-style set-global @@ -52,7 +52,7 @@ H{ { font-size $ font-size-title } { font-style bold } { wrap-margin $ wrap-margin-full } - { foreground COLOR: gray20 } + { foreground $ title-color } { page-color COLOR: FactorLightTan } { inset { 5 5 } } } title-style set-global @@ -61,7 +61,6 @@ SYMBOL: help-path-style H{ { font-size $ default-font-size } { table-gap { 5 5 } } - { table-border COLOR: FactorLightTan } } help-path-style set-global SYMBOL: heading-style @@ -69,7 +68,7 @@ H{ { font-name $ default-sans-serif-font-name } { font-size $ font-size-heading } { font-style bold } - { foreground COLOR: FactorDarkSlateBlue } + { foreground $ heading-color } } heading-style set-global SYMBOL: subsection-style @@ -83,7 +82,7 @@ SYMBOL: snippet-style H{ { font-name $ default-monospace-font-name } { font-size $ default-font-size } - { foreground COLOR: DarkOrange4 } + { foreground $ snippet-color } } snippet-style set-global SYMBOL: code-char-style @@ -94,7 +93,7 @@ H{ SYMBOL: code-style H{ - { page-color COLOR: FactorLightTan } + { page-color $ code-background-color } { inset { 5 5 } } { wrap-margin f } } code-style set-global @@ -102,27 +101,25 @@ H{ SYMBOL: output-style H{ { font-style bold } - { foreground COLOR: DarkOrange4 } + { foreground $ output-color } } output-style set-global SYMBOL: url-style H{ { font-name $ default-monospace-font-name } - { foreground COLOR: DodgerBlue4 } + { foreground $ url-color } } url-style set-global SYMBOL: warning-style H{ - { page-color COLOR: gray90 } - { border-color COLOR: red } + { page-color $ warning-background-color } { inset { 5 5 } } { wrap-margin $ wrap-margin-full } } warning-style set-global SYMBOL: deprecated-style H{ - { page-color COLOR: gray90 } - { border-color COLOR: red } + { page-color $ warning-background-color } { inset { 5 5 } } { wrap-margin $ wrap-margin-full } } deprecated-style set-global @@ -135,7 +132,7 @@ H{ SYMBOL: table-style H{ { table-gap { 5 5 } } - { table-border COLOR: FactorTan } + { table-border $ line-color } } table-style set-global SYMBOL: list-style diff --git a/basis/help/tips/tips.factor b/basis/help/tips/tips.factor index 29612941a8..8fa876a96c 100644 --- a/basis/help/tips/tips.factor +++ b/basis/help/tips/tips.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays colors.constants definitions help.markup -help.stylesheet io io.styles kernel literals namespaces parser random -sequences ; +help.stylesheet io io.styles kernel literals namespaces parser +random sequences ui.gadgets.theme ; IN: help.tips SYMBOL: tips @@ -30,7 +30,7 @@ SYNTAX: TIP: SYMBOL: tip-of-the-day-style H{ - { page-color COLOR: lavender } + { page-color $ tip-background-color } { inset { 5 5 } } { wrap-margin $ wrap-margin-full } } tip-of-the-day-style set-global diff --git a/basis/listener/listener.factor b/basis/listener/listener.factor index 8d9ac01d3e..067cf0636e 100644 --- a/basis/listener/listener.factor +++ b/basis/listener/listener.factor @@ -2,9 +2,10 @@ ! See http://factorcode.org/license.txt for BSD license. USING: accessors colors colors.constants combinators.short-circuit compiler.units continuations debugger -fry io io.styles kernel lexer locals math math.parser namespaces -parser parser.notes prettyprint sequences sets -source-files.errors system vocabs vocabs.loader vocabs.parser ; +fry io io.styles kernel lexer literals locals math math.parser +namespaces parser parser.notes prettyprint sequences sets +source-files.errors system ui.gadgets.theme vocabs vocabs.loader +vocabs.parser ; IN: listener GENERIC: stream-read-quot ( stream -- quot/f ) @@ -16,8 +17,8 @@ GENERIC# prompt. 1 ( stream prompt -- ) M: object prompt. nip H{ - { background T{ rgba f 1 0.7 0.7 1 } } - { foreground COLOR: black } + { background $ prompt-background-color } + { foreground $ text-color } } format bl flush ; : parse-lines-interactive ( lines -- quot/f ) diff --git a/basis/prettyprint/stylesheet/stylesheet.factor b/basis/prettyprint/stylesheet/stylesheet.factor index dd56e34723..b11abc9293 100644 --- a/basis/prettyprint/stylesheet/stylesheet.factor +++ b/basis/prettyprint/stylesheet/stylesheet.factor @@ -1,14 +1,12 @@ ! Copyright (C) 2009 Keith Lazuka, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: assocs colors colors.constants combinators +USING: assocs colors combinators combinators.short-circuit hashtables io.styles kernel literals -namespaces sequences words words.symbol ; +namespaces sequences ui.gadgets.theme words words.symbol ; IN: prettyprint.stylesheet : string-style ( str -- style ) - COLOR: LightSalmon4 colored-presentation-style ; + string-color colored-presentation-style ; : vocab-style ( vocab -- style ) dim-color colored-presentation-style ; @@ -48,7 +46,7 @@ PRIVATE> SYMBOL: stack-effect-style H{ - { foreground COLOR: FactorDarkGreen } + { foreground $ stack-effect-color } { font-style plain } } stack-effect-style set-global diff --git a/basis/ui/gadgets/editors/editors.factor b/basis/ui/gadgets/editors/editors.factor index f040136c8b..ba3d077f5a 100644 --- a/basis/ui/gadgets/editors/editors.factor +++ b/basis/ui/gadgets/editors/editors.factor @@ -609,7 +609,7 @@ TUPLE: field < border editor min-cols max-cols ; : field-theme ( gadget -- gadget ) { 2 2 } >>size { 1 0 } >>fill - COLOR: gray >>boundary ; inline + field-border-color >>boundary ; inline : ( gadget -- border ) border new-border field-theme ; diff --git a/basis/ui/gadgets/labeled/labeled.factor b/basis/ui/gadgets/labeled/labeled.factor index c414d2a594..9c6b3f208f 100644 --- a/basis/ui/gadgets/labeled/labeled.factor +++ b/basis/ui/gadgets/labeled/labeled.factor @@ -51,7 +51,7 @@ PRIVATE> add-content-area ; : ( gadget title color -- labeled ) - COLOR: grey85 >>boundary ; + labeled-border-color >>boundary ; : ( gadget title -- labeled ) vertical labeled-gadget new-track with-lines @@ -62,5 +62,5 @@ PRIVATE> { 5 5 } content-background >>interior 1 track-add - COLOR: grey85 >>boundary + labeled-border-color >>boundary { 3 3 } ; diff --git a/basis/ui/render/render.factor b/basis/ui/render/render.factor index 60269bc625..f28be2a2ac 100644 --- a/basis/ui/render/render.factor +++ b/basis/ui/render/render.factor @@ -150,15 +150,3 @@ M: gadget draw-children [ draw-gadget ] each ] with-scope ] [ drop ] if ; - -CONSTANT: selection-color T{ rgba f 0.8 0.8 1.0 1.0 } - -CONSTANT: panel-background-color - T{ rgba f - 0.7843137254901961 - 0.7686274509803922 - 0.7176470588235294 - 1.0 - } - -CONSTANT: focus-border-color COLOR: dark-gray diff --git a/basis/ui/tools/browser/popups/popups.factor b/basis/ui/tools/browser/popups/popups.factor index c792608e70..d4f01fd795 100644 --- a/basis/ui/tools/browser/popups/popups.factor +++ b/basis/ui/tools/browser/popups/popups.factor @@ -32,7 +32,7 @@ TUPLE: links-popup < wrapper ; 30 >>max-cols ; : ( model quot title -- gadget ) - [ COLOR: white >>interior ] dip + [ content-background >>interior ] dip popup-color links-popup new-wrapper ; links-popup H{ diff --git a/basis/ui/tools/listener/completion/completion.factor b/basis/ui/tools/listener/completion/completion.factor index 008f9ee818..39ee58ff22 100644 --- a/basis/ui/tools/listener/completion/completion.factor +++ b/basis/ui/tools/listener/completion/completion.factor @@ -148,7 +148,7 @@ GENERIC# accept-completion-hook 1 ( item popup -- ) dup '[ _ accept-completion ] >>action ; : ( completion-popup -- scroller ) - table>> COLOR: white >>interior ; + table>> content-background >>interior ; : ( interactor completion-mode -- popup ) [ vertical completion-popup new-track ] 2dip diff --git a/basis/vocabs/prettyprint/prettyprint.factor b/basis/vocabs/prettyprint/prettyprint.factor index c180beba90..480df1a368 100644 --- a/basis/vocabs/prettyprint/prettyprint.factor +++ b/basis/vocabs/prettyprint/prettyprint.factor @@ -1,9 +1,9 @@ ! Copyright (C) 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors arrays assocs colors colors.constants fry io -io.styles kernel make math.order namespaces parser +USING: accessors arrays assocs colors fry io +io.styles kernel literals make math.order namespaces parser prettyprint.backend prettyprint.sections prettyprint.stylesheet -sequences sets sorting vocabs vocabs.parser ; +sequences sets sorting ui.gadgets.theme vocabs vocabs.parser ; FROM: io.styles => inset ; IN: vocabs.prettyprint @@ -91,8 +91,8 @@ PRIVATE> "at the top of the source file:" print nl ] with-style { - { page-color COLOR: FactorLightTan } - { border-color COLOR: FactorDarkTan } + { page-color $ vocab-background-color } + { border-color $ vocab-border-color } { inset { 5 5 } } } [ manifest get pprint-manifest ] with-nesting nl nl