Implemented theme switching
parent
83a725563e
commit
6a912e47b4
|
@ -1,87 +1,88 @@
|
|||
! Copyright (C) 2016 Nicolas Pénet.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors colors colors.constants colors.hex ui.pens.solid ;
|
||||
IN: ui.gadgets.theme
|
||||
USING: accessors colors colors.constants colors.hex
|
||||
ui.gadgets.theme ui.pens.solid ;
|
||||
IN: ui.gadgets.theme.dark
|
||||
|
||||
CONSTANT: toolbar-background COLOR: solarized-base02
|
||||
CONSTANT: toolbar-button-pressed-background COLOR: solarized-base0
|
||||
M: dark toolbar-background COLOR: solarized-base02 ;
|
||||
M: dark toolbar-button-pressed-background COLOR: solarized-base0 ;
|
||||
|
||||
CONSTANT: menu-background COLOR: solarized-base02
|
||||
CONSTANT: menu-border-color COLOR: solarized-base01
|
||||
M: dark menu-background COLOR: solarized-base02 ;
|
||||
M: dark menu-border-color COLOR: solarized-base01 ;
|
||||
|
||||
CONSTANT: status-bar-background COLOR: FactorDarkSlateBlue
|
||||
CONSTANT: status-bar-foreground COLOR: white
|
||||
M: dark status-bar-background COLOR: FactorDarkSlateBlue ;
|
||||
M: dark status-bar-foreground COLOR: white ;
|
||||
|
||||
CONSTANT: button-text-color COLOR: solarized-base1
|
||||
CONSTANT: button-clicked-text-color COLOR: white
|
||||
M: dark button-text-color COLOR: solarized-base1 ;
|
||||
M: dark button-clicked-text-color COLOR: white ;
|
||||
|
||||
CONSTANT: line-color COLOR: solarized-base01
|
||||
M: dark line-color COLOR: solarized-base01 ;
|
||||
|
||||
CONSTANT: column-title-background COLOR: solarized-base01
|
||||
M: dark column-title-background COLOR: solarized-base01 ;
|
||||
|
||||
CONSTANT: roll-button-rollover-border COLOR: gray50
|
||||
CONSTANT: roll-button-selected-background COLOR: dark-gray
|
||||
M: dark roll-button-rollover-border COLOR: gray50 ;
|
||||
M: dark roll-button-selected-background COLOR: dark-gray ;
|
||||
|
||||
CONSTANT: source-files-color COLOR: solarized-green
|
||||
CONSTANT: errors-color COLOR: solarized-red
|
||||
CONSTANT: details-color COLOR: solarized-blue
|
||||
M: dark source-files-color COLOR: solarized-green ;
|
||||
M: dark errors-color COLOR: solarized-red ;
|
||||
M: dark details-color COLOR: solarized-blue ;
|
||||
|
||||
CONSTANT: debugger-color COLOR: solarized-red
|
||||
CONSTANT: completion-color COLOR: solarized-violet
|
||||
M: dark debugger-color COLOR: solarized-red ;
|
||||
M: dark completion-color COLOR: solarized-violet ;
|
||||
|
||||
CONSTANT: data-stack-color COLOR: solarized-blue
|
||||
CONSTANT: retain-stack-color COLOR: solarized-magenta
|
||||
CONSTANT: call-stack-color COLOR: solarized-green
|
||||
M: dark data-stack-color COLOR: solarized-blue ;
|
||||
M: dark retain-stack-color COLOR: solarized-magenta ;
|
||||
M: dark call-stack-color COLOR: solarized-green ;
|
||||
|
||||
CONSTANT: title-bar-gradient { COLOR: solarized-base01 COLOR: solarized-base02 }
|
||||
M: dark title-bar-gradient { COLOR: solarized-base01 COLOR: solarized-base02 } ;
|
||||
|
||||
CONSTANT: popup-color COLOR: solarized-yellow
|
||||
M: dark popup-color COLOR: solarized-yellow ;
|
||||
|
||||
CONSTANT: object-color COLOR: solarized-cyan
|
||||
CONSTANT: contents-color COLOR: solarized-magenta
|
||||
M: dark object-color COLOR: solarized-cyan ;
|
||||
M: dark contents-color COLOR: solarized-magenta ;
|
||||
|
||||
CONSTANT: help-header-background HEXCOLOR: 2F4D5B
|
||||
M: dark help-header-background HEXCOLOR: 2F4D5B ;
|
||||
|
||||
CONSTANT: thread-status-stopped-background HEXCOLOR: 492d33
|
||||
CONSTANT: thread-status-suspended-background HEXCOLOR: 3c4a24
|
||||
CONSTANT: thread-status-running-background HEXCOLOR: 2c4f24
|
||||
M: dark thread-status-stopped-background HEXCOLOR: 492d33 ;
|
||||
M: dark thread-status-suspended-background HEXCOLOR: 3c4a24 ;
|
||||
M: dark thread-status-running-background HEXCOLOR: 2c4f24 ;
|
||||
|
||||
CONSTANT: thread-status-stopped-foreground COLOR: solarized-red
|
||||
CONSTANT: thread-status-suspended-foreground COLOR: solarized-yellow
|
||||
CONSTANT: thread-status-running-foreground COLOR: solarized-green
|
||||
M: dark thread-status-stopped-foreground COLOR: solarized-red ;
|
||||
M: dark thread-status-suspended-foreground COLOR: solarized-yellow ;
|
||||
M: dark thread-status-running-foreground COLOR: solarized-green ;
|
||||
|
||||
CONSTANT: error-summary-background HEXCOLOR: 6E2E32
|
||||
M: dark error-summary-background HEXCOLOR: 6E2E32 ;
|
||||
|
||||
CONSTANT: content-background COLOR: solarized-base03
|
||||
CONSTANT: text-color COLOR: grey75
|
||||
M: dark content-background COLOR: solarized-base03 ;
|
||||
M: dark text-color COLOR: grey75 ;
|
||||
|
||||
CONSTANT: link-color COLOR: solarized-blue
|
||||
CONSTANT: url-color COLOR: solarized-blue
|
||||
CONSTANT: title-color COLOR: grey75
|
||||
CONSTANT: heading-color COLOR: grey75
|
||||
CONSTANT: snippet-color COLOR: solarized-orange
|
||||
CONSTANT: output-color COLOR: solarized-orange
|
||||
CONSTANT: warning-background-color HEXCOLOR: 6E2E32
|
||||
CONSTANT: code-background-color HEXCOLOR: 2F4D5B
|
||||
M: dark link-color COLOR: solarized-blue ;
|
||||
M: dark url-color COLOR: solarized-blue ;
|
||||
M: dark title-color COLOR: grey75 ;
|
||||
M: dark heading-color COLOR: grey75 ;
|
||||
M: dark snippet-color COLOR: solarized-orange ;
|
||||
M: dark output-color COLOR: solarized-orange ;
|
||||
M: dark warning-background-color HEXCOLOR: 6E2E32 ;
|
||||
M: dark code-background-color HEXCOLOR: 2F4D5B ;
|
||||
|
||||
CONSTANT: tip-background-color HEXCOLOR: 2F4D5B
|
||||
M: dark tip-background-color HEXCOLOR: 2F4D5B ;
|
||||
|
||||
CONSTANT: prompt-background-color HEXCOLOR: 922f31
|
||||
M: dark prompt-background-color HEXCOLOR: 922f31 ;
|
||||
|
||||
CONSTANT: dim-color COLOR: solarized-cyan
|
||||
CONSTANT: highlighted-word-color COLOR: solarized-green
|
||||
CONSTANT: string-color COLOR: solarized-magenta
|
||||
CONSTANT: stack-effect-color COLOR: solarized-orange
|
||||
M: dark dim-color COLOR: solarized-cyan ;
|
||||
M: dark highlighted-word-color COLOR: solarized-green ;
|
||||
M: dark string-color COLOR: solarized-magenta ;
|
||||
M: dark stack-effect-color COLOR: solarized-orange ;
|
||||
|
||||
CONSTANT: vocab-background-color COLOR: solarized-base01
|
||||
CONSTANT: vocab-border-color COLOR: solarized-base01
|
||||
M: dark vocab-background-color COLOR: solarized-base01 ;
|
||||
M: dark vocab-border-color COLOR: solarized-base01 ;
|
||||
|
||||
CONSTANT: field-border-color COLOR: solarized-base01
|
||||
M: dark field-border-color COLOR: solarized-base01 ;
|
||||
|
||||
CONSTANT: selection-color COLOR: solarized-base01
|
||||
M: dark selection-color COLOR: solarized-base01 ;
|
||||
|
||||
CONSTANT: panel-background-color T{ rgba f 0.7843 0.7686 0.7176 1.0 }
|
||||
M: dark panel-background-color T{ rgba f 0.7843 0.7686 0.7176 1.0 } ;
|
||||
|
||||
CONSTANT: focus-border-color COLOR: solarized-base01
|
||||
M: dark focus-border-color COLOR: solarized-base01 ;
|
||||
|
||||
CONSTANT: labeled-border-color COLOR: grey85
|
||||
M: dark labeled-border-color COLOR: grey85 ;
|
||||
|
|
|
@ -1,87 +1,88 @@
|
|||
! Copyright (C) 2015 Nicolas Pénet.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors colors colors.constants colors.hex ui.pens.solid ;
|
||||
IN: ui.gadgets.theme
|
||||
USING: accessors colors colors.constants colors.hex
|
||||
ui.gadgets.theme ui.pens.solid ;
|
||||
IN: ui.gadgets.theme.light
|
||||
|
||||
CONSTANT: toolbar-background COLOR: grey95
|
||||
CONSTANT: toolbar-button-pressed-background COLOR: dark-gray
|
||||
M: light toolbar-background COLOR: grey95 ;
|
||||
M: light toolbar-button-pressed-background COLOR: dark-gray ;
|
||||
|
||||
CONSTANT: menu-background COLOR: grey95
|
||||
CONSTANT: menu-border-color COLOR: grey75
|
||||
M: light menu-background COLOR: grey95 ;
|
||||
M: light menu-border-color COLOR: grey75 ;
|
||||
|
||||
CONSTANT: status-bar-background COLOR: FactorDarkSlateBlue
|
||||
CONSTANT: status-bar-foreground COLOR: white
|
||||
M: light status-bar-background COLOR: FactorDarkSlateBlue ;
|
||||
M: light status-bar-foreground COLOR: white ;
|
||||
|
||||
CONSTANT: button-text-color COLOR: FactorDarkSlateBlue
|
||||
CONSTANT: button-clicked-text-color COLOR: white
|
||||
M: light button-text-color COLOR: FactorDarkSlateBlue ;
|
||||
M: light button-clicked-text-color COLOR: white ;
|
||||
|
||||
CONSTANT: line-color COLOR: grey75
|
||||
M: light line-color COLOR: grey75 ;
|
||||
|
||||
CONSTANT: column-title-background COLOR: grey95
|
||||
M: light column-title-background COLOR: grey95 ;
|
||||
|
||||
CONSTANT: roll-button-rollover-border COLOR: gray50
|
||||
CONSTANT: roll-button-selected-background COLOR: dark-gray
|
||||
M: light roll-button-rollover-border COLOR: gray50 ;
|
||||
M: light roll-button-selected-background COLOR: dark-gray ;
|
||||
|
||||
CONSTANT: source-files-color COLOR: MediumSeaGreen
|
||||
CONSTANT: errors-color COLOR: chocolate1
|
||||
CONSTANT: details-color COLOR: SteelBlue3
|
||||
M: light source-files-color COLOR: MediumSeaGreen ;
|
||||
M: light errors-color COLOR: chocolate1 ;
|
||||
M: light details-color COLOR: SteelBlue3 ;
|
||||
|
||||
CONSTANT: debugger-color COLOR: chocolate1
|
||||
CONSTANT: completion-color COLOR: magenta
|
||||
M: light debugger-color COLOR: chocolate1 ;
|
||||
M: light completion-color COLOR: magenta ;
|
||||
|
||||
CONSTANT: data-stack-color COLOR: DodgerBlue
|
||||
CONSTANT: retain-stack-color COLOR: HotPink
|
||||
CONSTANT: call-stack-color COLOR: GreenYellow
|
||||
M: light data-stack-color COLOR: DodgerBlue ;
|
||||
M: light retain-stack-color COLOR: HotPink ;
|
||||
M: light call-stack-color COLOR: GreenYellow ;
|
||||
|
||||
CONSTANT: title-bar-gradient { COLOR: white COLOR: grey90 }
|
||||
M: light title-bar-gradient { COLOR: white COLOR: grey90 } ;
|
||||
|
||||
CONSTANT: popup-color COLOR: yellow2
|
||||
M: light popup-color COLOR: yellow2 ;
|
||||
|
||||
CONSTANT: object-color COLOR: aquamarine2
|
||||
CONSTANT: contents-color COLOR: orchid2
|
||||
M: light object-color COLOR: aquamarine2 ;
|
||||
M: light contents-color COLOR: orchid2 ;
|
||||
|
||||
CONSTANT: help-header-background HEXCOLOR: F4EFD9
|
||||
M: light help-header-background HEXCOLOR: F4EFD9 ;
|
||||
|
||||
CONSTANT: thread-status-stopped-background HEXCOLOR: F4D9D9
|
||||
CONSTANT: thread-status-suspended-background HEXCOLOR: F4EAD9
|
||||
CONSTANT: thread-status-running-background HEXCOLOR: EDF4D9
|
||||
M: light thread-status-stopped-background HEXCOLOR: F4D9D9 ;
|
||||
M: light thread-status-suspended-background HEXCOLOR: F4EAD9 ;
|
||||
M: light thread-status-running-background HEXCOLOR: EDF4D9 ;
|
||||
|
||||
CONSTANT: thread-status-stopped-foreground HEXCOLOR: F42300
|
||||
CONSTANT: thread-status-suspended-foreground HEXCOLOR: F37B00
|
||||
CONSTANT: thread-status-running-foreground HEXCOLOR: 3FCA00
|
||||
M: light thread-status-stopped-foreground HEXCOLOR: F42300 ;
|
||||
M: light thread-status-suspended-foreground HEXCOLOR: F37B00 ;
|
||||
M: light thread-status-running-foreground HEXCOLOR: 3FCA00 ;
|
||||
|
||||
CONSTANT: error-summary-background HEXCOLOR: F4D9D9
|
||||
M: light error-summary-background HEXCOLOR: F4D9D9 ;
|
||||
|
||||
CONSTANT: content-background COLOR: white
|
||||
CONSTANT: text-color COLOR: black
|
||||
M: light content-background COLOR: white ;
|
||||
M: light text-color COLOR: black ;
|
||||
|
||||
CONSTANT: link-color COLOR: DodgerBlue4
|
||||
CONSTANT: url-color COLOR: DodgerBlue4
|
||||
CONSTANT: title-color COLOR: gray20
|
||||
CONSTANT: heading-color COLOR: FactorDarkSlateBlue
|
||||
CONSTANT: snippet-color COLOR: DarkOrange4
|
||||
CONSTANT: output-color COLOR: DarkOrange4
|
||||
CONSTANT: warning-background-color COLOR: gray90
|
||||
CONSTANT: code-background-color COLOR: FactorLightTan
|
||||
M: light link-color COLOR: DodgerBlue4 ;
|
||||
M: light url-color COLOR: DodgerBlue4 ;
|
||||
M: light title-color COLOR: gray20 ;
|
||||
M: light heading-color COLOR: FactorDarkSlateBlue ;
|
||||
M: light snippet-color COLOR: DarkOrange4 ;
|
||||
M: light output-color COLOR: DarkOrange4 ;
|
||||
M: light warning-background-color COLOR: gray90 ;
|
||||
M: light code-background-color COLOR: FactorLightTan ;
|
||||
|
||||
CONSTANT: tip-background-color COLOR: lavender
|
||||
M: light tip-background-color COLOR: lavender ;
|
||||
|
||||
CONSTANT: prompt-background-color T{ rgba f 1 0.7 0.7 1 }
|
||||
M: light prompt-background-color T{ rgba f 1 0.7 0.7 1 } ;
|
||||
|
||||
CONSTANT: dim-color COLOR: gray35
|
||||
CONSTANT: highlighted-word-color COLOR: DarkSlateGray
|
||||
CONSTANT: string-color COLOR: LightSalmon4
|
||||
CONSTANT: stack-effect-color COLOR: FactorDarkGreen
|
||||
M: light dim-color COLOR: gray35 ;
|
||||
M: light highlighted-word-color COLOR: DarkSlateGray ;
|
||||
M: light string-color COLOR: LightSalmon4 ;
|
||||
M: light stack-effect-color COLOR: FactorDarkGreen ;
|
||||
|
||||
CONSTANT: vocab-background-color COLOR: FactorLightTan
|
||||
CONSTANT: vocab-border-color COLOR: FactorDarkTan
|
||||
M: light vocab-background-color COLOR: FactorLightTan ;
|
||||
M: light vocab-border-color COLOR: FactorDarkTan ;
|
||||
|
||||
CONSTANT: field-border-color COLOR: gray
|
||||
M: light field-border-color COLOR: gray ;
|
||||
|
||||
CONSTANT: selection-color T{ rgba f 0.8 0.8 1.0 1.0 }
|
||||
M: light selection-color T{ rgba f 0.8 0.8 1.0 1.0 } ;
|
||||
|
||||
CONSTANT: panel-background-color T{ rgba f 0.7843 0.7686 0.7176 1.0 }
|
||||
M: light panel-background-color T{ rgba f 0.7843 0.7686 0.7176 1.0 } ;
|
||||
|
||||
CONSTANT: focus-border-color COLOR: dark-gray
|
||||
M: light focus-border-color COLOR: dark-gray ;
|
||||
|
||||
CONSTANT: labeled-border-color COLOR: grey85
|
||||
M: light labeled-border-color COLOR: grey85 ;
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
! Copyright (C) 2009, 2010 Slava Pestov, Joe Groff.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: fry hashtables help.stylesheet io.styles kernel
|
||||
namespaces ui.gadgets.theme ;
|
||||
IN: ui.gadgets.theme.switching
|
||||
|
||||
: (update-style) ( style color elt -- )
|
||||
'[ _ _ rot ?set-at ] change-global ;
|
||||
|
||||
: update-stylesheet ( -- )
|
||||
default-span-style text-color foreground (update-style)
|
||||
link-style link-color foreground (update-style)
|
||||
title-style title-color foreground (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 url-color foreground (update-style)
|
||||
warning-style warning-background-color page-color (update-style)
|
||||
deprecated-style warning-background-color page-color (update-style)
|
||||
table-style line-color table-border (update-style) ;
|
||||
|
||||
: light-theme ( -- ) light new theme set-global update-stylesheet ;
|
||||
: dark-theme ( -- ) dark new theme set-global update-stylesheet ;
|
||||
|
||||
light-theme
|
|
@ -6,4 +6,91 @@ IN: ui.gadgets.theme
|
|||
: theme-image ( name -- image-name )
|
||||
"vocab:ui/gadgets/theme/" prepend-path ".tiff" append <image-name> ;
|
||||
|
||||
<< "ui.gadgets.theme.light" require >>
|
||||
SYMBOL: theme
|
||||
TUPLE: light ;
|
||||
TUPLE: dark ;
|
||||
|
||||
light new theme set-global
|
||||
|
||||
HOOK: toolbar-background theme ( -- color )
|
||||
HOOK: toolbar-button-pressed-background theme ( -- color )
|
||||
|
||||
HOOK: menu-background theme ( -- color )
|
||||
HOOK: menu-border-color theme ( -- color )
|
||||
|
||||
HOOK: status-bar-background theme ( -- color )
|
||||
HOOK: status-bar-foreground theme ( -- color )
|
||||
|
||||
HOOK: button-text-color theme ( -- color )
|
||||
HOOK: button-clicked-text-color theme ( -- color )
|
||||
|
||||
HOOK: line-color theme ( -- color )
|
||||
|
||||
HOOK: column-title-background theme ( -- color )
|
||||
|
||||
HOOK: roll-button-rollover-border theme ( -- color )
|
||||
HOOK: roll-button-selected-background theme ( -- color )
|
||||
|
||||
HOOK: source-files-color theme ( -- color )
|
||||
HOOK: errors-color theme ( -- color )
|
||||
HOOK: details-color theme ( -- color )
|
||||
|
||||
HOOK: debugger-color theme ( -- color )
|
||||
HOOK: completion-color theme ( -- color )
|
||||
|
||||
HOOK: data-stack-color theme ( -- color )
|
||||
HOOK: retain-stack-color theme ( -- color )
|
||||
HOOK: call-stack-color theme ( -- color )
|
||||
|
||||
HOOK: title-bar-gradient theme ( -- color )
|
||||
|
||||
HOOK: popup-color theme ( -- color )
|
||||
|
||||
HOOK: object-color theme ( -- color )
|
||||
HOOK: contents-color theme ( -- color )
|
||||
|
||||
HOOK: help-header-background theme ( -- color )
|
||||
|
||||
HOOK: thread-status-stopped-background theme ( -- color )
|
||||
HOOK: thread-status-suspended-background theme ( -- color )
|
||||
HOOK: thread-status-running-background theme ( -- color )
|
||||
|
||||
HOOK: thread-status-stopped-foreground theme ( -- color )
|
||||
HOOK: thread-status-suspended-foreground theme ( -- color )
|
||||
HOOK: thread-status-running-foreground theme ( -- color )
|
||||
|
||||
HOOK: error-summary-background theme ( -- color )
|
||||
|
||||
HOOK: content-background theme ( -- color )
|
||||
HOOK: text-color theme ( -- color )
|
||||
|
||||
HOOK: link-color theme ( -- color )
|
||||
HOOK: url-color theme ( -- color )
|
||||
HOOK: title-color theme ( -- color )
|
||||
HOOK: heading-color theme ( -- color )
|
||||
HOOK: snippet-color theme ( -- color )
|
||||
HOOK: output-color theme ( -- color )
|
||||
HOOK: warning-background-color theme ( -- color )
|
||||
HOOK: code-background-color theme ( -- color )
|
||||
|
||||
HOOK: tip-background-color theme ( -- color )
|
||||
|
||||
HOOK: prompt-background-color theme ( -- color )
|
||||
|
||||
HOOK: dim-color theme ( -- color )
|
||||
HOOK: highlighted-word-color theme ( -- color )
|
||||
HOOK: string-color theme ( -- color )
|
||||
HOOK: stack-effect-color theme ( -- color )
|
||||
|
||||
HOOK: vocab-background-color theme ( -- color )
|
||||
HOOK: vocab-border-color theme ( -- color )
|
||||
|
||||
HOOK: field-border-color theme ( -- color )
|
||||
|
||||
HOOK: selection-color theme ( -- color )
|
||||
|
||||
HOOK: panel-background-color theme ( -- color )
|
||||
|
||||
HOOK: focus-border-color theme ( -- color )
|
||||
|
||||
HOOK: labeled-border-color theme ( -- color )
|
||||
|
|
Loading…
Reference in New Issue