ui.theme: updates to color scheme.

Fixes circularity and adds theme switching to Mac menu.
Could use some simplification and reduction in color theme hooks.
locals-and-roots
John Benediktsson 2016-05-09 21:34:31 -07:00
parent 7a028977c4
commit 63410f62c8
28 changed files with 430 additions and 150 deletions

View File

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBClasses</key>
<array>
<dict>
<key>ACTIONS</key>
<dict>
<key>factorBrowser</key>
<string>id</string>
<key>factorListener</key>
<string>id</string>
<key>newFactorBrowser</key>
<string>id</string>
<key>newFactorListener</key>
<string>id</string>
<key>refreshAll</key>
<string>id</string>
<key>runFactorFile</key>
<string>id</string>
<key>saveFactorImage</key>
<string>id</string>
<key>saveFactorImageAs</key>
<string>id</string>
</dict>
<key>CLASS</key>
<string>FirstResponder</string>
<key>LANGUAGE</key>
<string>ObjC</string>
<key>SUPERCLASS</key>
<string>NSObject</string>
</dict>
</array>
<key>IBVersion</key>
<string>1</string>
</dict>
</plist>

View File

@ -0,0 +1,282 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10116" systemVersion="15E65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment version="1050" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10116"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication"/>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<menu title="Factor.app:Contents:Resources:English.lproj:MenuBar" systemMenu="main" id="29" userLabel="MainMenu">
<items>
<menuItem title="Factor" id="56">
<menu key="submenu" title="Factor" systemMenu="apple" id="57">
<items>
<menuItem title="About Factor" id="58">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontStandardAboutPanel:" target="-2" id="142"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="236">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Run Factor Source…" keyEquivalent="o" id="366">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="runFactorFile:" target="-1" id="rgF-Ks-Gn8"/>
</connections>
</menuItem>
<menuItem title="Save Factor Image" keyEquivalent="s" id="368">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="saveFactorImage:" target="-1" id="Iu7-Jk-Gn3"/>
</connections>
</menuItem>
<menuItem title="Save Factor Image As…" keyEquivalent="S" id="369">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="saveFactorImageAs:" target="-1" id="YdH-jx-wV1"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="365"/>
<menuItem title="Services" id="131">
<menu key="submenu" title="Services" systemMenu="services" id="130"/>
</menuItem>
<menuItem isSeparatorItem="YES" id="144">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Hide Factor" keyEquivalent="h" id="134">
<connections>
<action selector="hide:" target="-2" id="152"/>
</connections>
</menuItem>
<menuItem title="Hide Others" keyEquivalent="h" id="145">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="hideOtherApplications:" target="-2" id="146"/>
</connections>
</menuItem>
<menuItem title="Show All" id="150">
<connections>
<action selector="unhideAllApplications:" target="-2" id="153"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="149">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Quit Factor" keyEquivalent="q" id="136">
<connections>
<action selector="terminate:" target="-2" id="139"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="File" id="343">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="File" id="344">
<items>
<menuItem title="New" keyEquivalent="n" id="345">
<connections>
<action selector="newDocument:" target="-1" id="358"/>
</connections>
</menuItem>
<menuItem title="Open…" keyEquivalent="o" id="346">
<connections>
<action selector="openDocument:" target="-1" id="359"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="348"/>
<menuItem title="Close" keyEquivalent="w" id="349">
<connections>
<action selector="performClose:" target="-1" id="360"/>
</connections>
</menuItem>
<menuItem title="Save" keyEquivalent="s" id="350">
<connections>
<action selector="saveDocument:" target="-1" id="361"/>
</connections>
</menuItem>
<menuItem title="Save As…" keyEquivalent="S" id="351">
<connections>
<action selector="saveDocumentAs:" target="-1" id="362"/>
</connections>
</menuItem>
<menuItem title="Revert" id="352">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="revertDocumentToSaved:" target="-1" id="363"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Edit" id="304">
<menu key="submenu" title="Edit" id="305">
<items>
<menuItem title="Undo" keyEquivalent="z" id="306">
<connections>
<action selector="undo:" target="-1" id="332"/>
</connections>
</menuItem>
<menuItem title="Redo" keyEquivalent="Z" id="307">
<connections>
<action selector="redo:" target="-1" id="333"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="308">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Cut" keyEquivalent="x" id="309">
<connections>
<action selector="cut:" target="-1" id="341"/>
</connections>
</menuItem>
<menuItem title="Copy" keyEquivalent="c" id="310">
<connections>
<action selector="copy:" target="-1" id="335"/>
</connections>
</menuItem>
<menuItem title="Paste" keyEquivalent="v" id="311">
<connections>
<action selector="paste:" target="-1" id="336"/>
</connections>
</menuItem>
<menuItem title="Delete" id="313">
<connections>
<action selector="delete:" target="-1" id="337"/>
</connections>
</menuItem>
<menuItem title="Select All" keyEquivalent="a" id="314">
<connections>
<action selector="selectAll:" target="-1" id="338"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="315">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Find" id="316">
<menu key="submenu" title="Find" id="326">
<items>
<menuItem title="Find…" tag="1" keyEquivalent="f" id="327"/>
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="328"/>
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="329"/>
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="330"/>
<menuItem title="Jump to Selection" keyEquivalent="j" id="331"/>
</items>
</menu>
</menuItem>
<menuItem title="Spelling" id="317">
<menu key="submenu" title="Spelling" id="322">
<items>
<menuItem title="Spelling…" keyEquivalent=":" id="323"/>
<menuItem title="Check Spelling" keyEquivalent=";" id="324"/>
<menuItem title="Check Spelling as You Type" id="325"/>
</items>
</menu>
</menuItem>
<menuItem title="Speech" id="318">
<menu key="submenu" title="Speech" id="319">
<items>
<menuItem title="Start Speaking" id="320"/>
<menuItem title="Stop Speaking" id="321"/>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Tools" id="283">
<menu key="submenu" title="Tools" id="284">
<items>
<menuItem title="Show Listener" keyEquivalent="l" id="286">
<connections>
<action selector="showFactorListener:" target="-1" id="r8I-gi-bmO"/>
</connections>
</menuItem>
<menuItem title="New Listener" keyEquivalent="L" id="287">
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
<connections>
<action selector="newFactorListener:" target="-1" id="7yk-oP-H5Z"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="290">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Show Browser" keyEquivalent="b" id="288">
<connections>
<action selector="showFactorBrowser:" target="-1" id="g0e-dO-s7I"/>
</connections>
</menuItem>
<menuItem title="New Browser" keyEquivalent="B" id="289">
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
<connections>
<action selector="newFactorBrowser:" target="-1" id="cLP-Ug-xfc"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="PMQ-EN-0tV">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Switch Theme" id="Wvq-ot-R3p">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Switch Theme" id="HqQ-K2-6Sn">
<items>
<menuItem title="Light" id="dSP-rb-Ak9">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="switchLightTheme:" target="-1" id="Y29-I0-nL0"/>
</connections>
</menuItem>
<menuItem title="Dark" id="hBk-Ue-CIf">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="switchDarkTheme:" target="-1" id="2ug-u3-tEU"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Window" id="19">
<menu key="submenu" title="Window" systemMenu="window" id="24">
<items>
<menuItem title="Minimize" keyEquivalent="m" id="23">
<connections>
<action selector="performMiniaturize:" target="-1" id="37"/>
</connections>
</menuItem>
<menuItem title="Zoom" id="239">
<connections>
<action selector="performZoom:" target="-1" id="240"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="92">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
<menuItem title="Bring All to Front" id="5">
<connections>
<action selector="arrangeInFront:" target="-1" id="39"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Help" id="103">
<menu key="submenu" title="Help" id="106">
<items>
<menuItem title="Factor Help" keyEquivalent="?" id="111">
<connections>
<action selector="showFactorBrowser:" target="-1" id="Ddd-ic-q9J"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</objects>
</document>

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IBFramework Version</key>
<string>677</string>
<key>IBOldestOS</key>
<integer>5</integer>
<key>IBOpenObjects</key>
<array/>
<key>IBSystem Version</key>
<string>9J61</string>
<key>targetFramework</key>
<string>IBCocoaFramework</string>
</dict>
</plist>

View File

@ -108,12 +108,13 @@ H{
SYMBOL: url-style SYMBOL: url-style
H{ H{
{ font-name $ default-monospace-font-name } { font-name $ default-monospace-font-name }
{ foreground $ url-color } { foreground $ link-color }
} url-style set-global } url-style set-global
SYMBOL: warning-style SYMBOL: warning-style
H{ H{
{ page-color $ warning-background-color } { page-color $ warning-background-color }
{ border-color $ warning-border-color }
{ inset { 5 5 } } { inset { 5 5 } }
{ wrap-margin $ wrap-margin-full } { wrap-margin $ wrap-margin-full }
} warning-style set-global } warning-style set-global
@ -121,6 +122,7 @@ H{
SYMBOL: deprecated-style SYMBOL: deprecated-style
H{ H{
{ page-color $ warning-background-color } { page-color $ warning-background-color }
{ border-color $ warning-border-color }
{ inset { 5 5 } } { inset { 5 5 } }
{ wrap-margin $ wrap-margin-full } { wrap-margin $ wrap-margin-full }
} deprecated-style set-global } deprecated-style set-global

View File

@ -1,6 +1,6 @@
USING: debugger editors help help.apropos help.markup USING: debugger editors help help.apropos help.markup
help.syntax help.vocabs memory see stack-checker help.syntax help.vocabs memory see stack-checker
tools.destructors tools.time ui.theme.switching ; tools.destructors tools.time ;
IN: help.tips IN: help.tips
TIP: "To look at the most recent error, run " { $link :error } ". To look at the most recent error's callstack, run " { $link :c } "." ; TIP: "To look at the most recent error, run " { $link :error } ". To look at the most recent error's callstack, run " { $link :c } "." ;
@ -27,8 +27,6 @@ TIP: "To save time on reloading big libraries such as the " { $vocab-link "furna
TIP: "Use the " { $link leaks. } " combinator to track down resource leaks." ; TIP: "Use the " { $link leaks. } " combinator to track down resource leaks." ;
TIP: "Use " { $link light-mode } " and " { $link dark-mode } " for a light or dark user interface." ;
HELP: TIP: HELP: TIP:
{ $syntax "TIP: content ;" } { $syntax "TIP: content ;" }
{ $values { "content" "a markup element" } } { $values { "content" "a markup element" } }

View File

@ -4,7 +4,7 @@ USING: accessors colors colors.constants
combinators.short-circuit compiler.units continuations debugger combinators.short-circuit compiler.units continuations debugger
fry io io.styles kernel lexer literals locals math math.parser fry io io.styles kernel lexer literals locals math math.parser
namespaces parser parser.notes prettyprint sequences sets namespaces parser parser.notes prettyprint sequences sets
source-files.errors system ui.theme vocabs vocabs.loader source-files.errors system vocabs vocabs.loader
vocabs.parser ; vocabs.parser ;
IN: listener IN: listener
@ -17,8 +17,8 @@ GENERIC# prompt. 1 ( stream prompt -- )
SYMBOL: prompt-style SYMBOL: prompt-style
H{ H{
{ background $ prompt-background-color } { background T{ rgba f 1 0.7 0.7 1 } }
{ foreground $ text-color } { foreground COLOR: black }
} prompt-style set-global } prompt-style set-global
M: object prompt. M: object prompt.

View File

@ -1,15 +1,15 @@
! Copyright (C) 2009 Keith Lazuka, Slava Pestov. ! Copyright (C) 2009 Keith Lazuka, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: assocs colors combinators USING: assocs colors colors.constants combinators
combinators.short-circuit hashtables io.styles kernel literals combinators.short-circuit hashtables io.styles kernel literals
namespaces sequences ui.theme words words.symbol ; namespaces sequences words words.symbol ;
IN: prettyprint.stylesheet IN: prettyprint.stylesheet
<PRIVATE <PRIVATE
{ POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: } { POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: }
[ [
{ { foreground $ dim-color } } { { foreground COLOR: gray35 } }
"word-style" set-word-prop "word-style" set-word-prop
] each ] each
@ -17,39 +17,44 @@ PREDICATE: highlighted-word < word [ parsing-word? ] [ delimiter? ] bi or ;
PRIVATE> PRIVATE>
SYMBOL: base-word-style
H{ } base-word-style set-global
GENERIC: word-style ( word -- style ) GENERIC: word-style ( word -- style )
M: word word-style M: word word-style
[ presented associate ] [ presented base-word-style get clone [ set-at ] keep ]
[ "word-style" word-prop ] bi assoc-union! [ "word-style" word-prop ] bi assoc-union! ;
text-color foreground pick set-at ;
SYMBOL: highlighted-word-style
H{
{ foreground COLOR: DarkSlateGray }
} highlighted-word-style set-global
M: highlighted-word word-style M: highlighted-word word-style
call-next-method call-next-method highlighted-word-style get assoc-union! ;
highlighted-word-color foreground pick set-at ;
<PRIVATE SYMBOL: base-string-style
H{
: colored-presentation-style ( obj color -- style ) { foreground COLOR: LightSalmon4 }
2 <hashtable> [ } base-string-style set-global
[ presented foreground ] dip
[ set-at ] curry bi-curry@ bi*
] keep ;
PRIVATE>
: string-style ( str -- style ) : string-style ( str -- style )
string-color colored-presentation-style ; presented base-string-style get clone [ set-at ] keep ;
SYMBOL: base-vocab-style
H{
{ foreground COLOR: gray35 }
} base-vocab-style set-global
: vocab-style ( vocab -- style ) : vocab-style ( vocab -- style )
dim-color colored-presentation-style ; presented base-vocab-style get clone [ set-at ] keep ;
SYMBOL: stack-effect-style SYMBOL: stack-effect-style
H{ H{
{ foreground $ stack-effect-color } { foreground COLOR: FactorDarkGreen }
{ font-style plain } { font-style plain }
} stack-effect-style set-global } stack-effect-style set-global
: effect-style ( effect -- style ) : effect-style ( effect -- style )
presented associate stack-effect-style get assoc-union! ; presented stack-effect-style get clone [ set-at ] keep ;

View File

@ -1,11 +1,11 @@
! Copyright (C) 2006, 2010 Slava Pestov. ! Copyright (C) 2006, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax cocoa cocoa.nibs cocoa.application USING: alien.syntax cocoa cocoa.application cocoa.classes
cocoa.classes cocoa.dialogs cocoa.pasteboard cocoa.runtime cocoa.dialogs cocoa.nibs cocoa.pasteboard cocoa.runtime
cocoa.subclassing core-foundation core-foundation.strings cocoa.subclassing core-foundation.strings eval kernel listener
help.topics kernel memory namespaces parser system ui locals memory namespaces system ui.backend.cocoa
ui.tools.browser ui.tools.listener ui.backend.cocoa eval ui.theme.switching ui.tools.browser ui.tools.listener
locals listener vocabs.refresh ; vocabs.refresh ;
FROM: alien.c-types => int void ; FROM: alien.c-types => int void ;
IN: ui.backend.cocoa.tools IN: ui.backend.cocoa.tools
@ -27,9 +27,9 @@ CLASS: FactorWorkspaceApplicationDelegate < FactorApplicationDelegate
METHOD: int applicationShouldHandleReopen: id app hasVisibleWindows: int flag [ flag 0 = [ show-listener ] when 1 ] ; METHOD: int applicationShouldHandleReopen: id app hasVisibleWindows: int flag [ flag 0 = [ show-listener ] when 1 ] ;
METHOD: id factorListener: id app [ show-listener f ] ; METHOD: id showFactorListener: id app [ show-listener f ] ;
METHOD: id factorBrowser: id app [ show-browser f ] ; METHOD: id showFactorBrowser: id app [ show-browser f ] ;
METHOD: id newFactorListener: id app [ listener-window f ] ; METHOD: id newFactorListener: id app [ listener-window f ] ;
@ -41,6 +41,10 @@ CLASS: FactorWorkspaceApplicationDelegate < FactorApplicationDelegate
METHOD: id saveFactorImageAs: id app [ menu-save-image f ] ; METHOD: id saveFactorImageAs: id app [ menu-save-image f ] ;
METHOD: id switchLightTheme: id app [ light-mode f ] ;
METHOD: id switchDarkTheme: id app [ dark-mode f ] ;
METHOD: id refreshAll: id app [ [ refresh-all ] \ refresh-all call-listener f ] ; METHOD: id refreshAll: id app [ [ refresh-all ] \ refresh-all call-listener f ] ;
; ;

View File

@ -2,8 +2,8 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays colors.constants combinators fonts fry USING: accessors arrays colors.constants combinators fonts fry
kernel make math.functions models namespaces sequences splitting kernel make math.functions models namespaces sequences splitting
strings ui.baseline-alignment ui.gadgets ui.gadgets.tracks strings ui.baseline-alignment ui.gadgets ui.gadgets.theme
ui.pens.solid ui.render ui.text ui.tools.common ; ui.gadgets.tracks ui.pens.solid ui.render ui.text ;
IN: ui.gadgets.labels IN: ui.gadgets.labels
! A label gadget draws a string. ! A label gadget draws a string.

View File

@ -3,7 +3,7 @@
USING: accessors arrays combinators fry kernel math USING: accessors arrays combinators fry kernel math
math.functions math.order math.ranges math.vectors namespaces math.functions math.order math.ranges math.vectors namespaces
opengl sequences ui.gadgets ui.gadgets.scrollers opengl sequences ui.gadgets ui.gadgets.scrollers
ui.gadgets.viewports ui.render ui.text ; ui.gadgets.viewports ui.render ui.text ui.theme ;
IN: ui.gadgets.line-support IN: ui.gadgets.line-support
! Some code shared by table and editor gadgets ! Some code shared by table and editor gadgets

View File

@ -3,8 +3,8 @@
USING: accessors kernel locals math.rectangles math.vectors USING: accessors kernel locals math.rectangles math.vectors
namespaces opengl sequences sorting ui.commands ui.gadgets namespaces opengl sequences sorting ui.commands ui.gadgets
ui.gadgets.buttons ui.gadgets.glass ui.gadgets.packs ui.gadgets.buttons ui.gadgets.glass ui.gadgets.packs
ui.gadgets.theme ui.gadgets.worlds ui.gestures ui.operations ui.gadgets.worlds ui.gestures ui.operations
ui.pens ui.pens.solid ui.tools.common ; ui.pens ui.pens.solid ui.theme ui.tools.common ;
IN: ui.gadgets.menus IN: ui.gadgets.menus
: show-menu ( owner menu -- ) : show-menu ( owner menu -- )

View File

@ -9,7 +9,7 @@ ui.gadgets.icons ui.gadgets.incremental ui.gadgets.labels
ui.gadgets.menus ui.gadgets.packs ui.gadgets.paragraphs ui.gadgets.menus ui.gadgets.packs ui.gadgets.paragraphs
ui.gadgets.presentations ui.gadgets.private ui.gadgets.scrollers ui.gadgets.presentations ui.gadgets.private ui.gadgets.scrollers
ui.gadgets.tracks ui.gestures ui.images ui.pens.solid ui.render ui.gadgets.tracks ui.gestures ui.images ui.pens.solid ui.render
ui.traverse ; ui.theme ui.traverse ;
FROM: io.styles => foreground background ; FROM: io.styles => foreground background ;
FROM: ui.gadgets.wrappers => <wrapper> ; FROM: ui.gadgets.wrappers => <wrapper> ;
IN: ui.gadgets.panes IN: ui.gadgets.panes

View File

@ -3,8 +3,7 @@
USING: accessors kernel memoize namespaces ui.commands ui.gadgets USING: accessors kernel memoize namespaces ui.commands ui.gadgets
ui.gadgets.borders ui.gadgets.buttons ui.gadgets.buttons.private ui.gadgets.borders ui.gadgets.buttons ui.gadgets.buttons.private
ui.gadgets.glass ui.gadgets.menus ui.gadgets.status-bar ui.gadgets.glass ui.gadgets.menus ui.gadgets.status-bar
ui.gadgets.theme ui.gadgets.worlds ui.gestures ui.gadgets.worlds ui.gestures ui.operations ui.pens.solid ui.theme ;
ui.operations ui.pens.solid ;
IN: ui.gadgets.presentations IN: ui.gadgets.presentations
TUPLE: presentation < button object hook ; TUPLE: presentation < button object hook ;

View File

@ -3,7 +3,7 @@
USING: accessors calendar colors.constants fonts kernel models USING: accessors calendar colors.constants fonts kernel models
models.arrow models.delay sequences summary ui models.arrow models.delay sequences summary ui
ui.gadgets.borders ui.gadgets.labels ui.gadgets.tracks ui.gadgets.borders ui.gadgets.labels ui.gadgets.tracks
ui.gadgets.theme ui.gadgets.worlds ui.pens.solid ui.private ; ui.gadgets.worlds ui.pens.solid ui.private ui.theme ;
IN: ui.gadgets.status-bar IN: ui.gadgets.status-bar
: status-bar-font ( -- font ) : status-bar-font ( -- font )

View File

@ -5,8 +5,8 @@ combinators.short-circuit fonts fry kernel locals math
math.functions math.order math.rectangles math.vectors models math.functions math.order math.rectangles math.vectors models
namespaces opengl sequences splitting strings ui.commands namespaces opengl sequences splitting strings ui.commands
ui.gadgets ui.gadgets.line-support ui.gadgets.menus ui.gadgets ui.gadgets.line-support ui.gadgets.menus
ui.gadgets.scrollers ui.gadgets.status-bar ui.gadgets.theme ui.gadgets.worlds ui.gadgets.scrollers ui.gadgets.status-bar ui.gadgets.worlds
ui.gestures ui.images ui.pens.solid ui.render ui.text ; ui.gestures ui.images ui.pens.solid ui.render ui.text ui.theme ;
IN: ui.gadgets.tables IN: ui.gadgets.tables
! Row rendererer protocol ! Row rendererer protocol

View File

@ -1,7 +1,10 @@
! Copyright (C) 2009, 2010 Slava Pestov, Joe Groff. ! Copyright (C) 2009, 2010 Slava Pestov, Joe Groff.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: io.pathnames sequences ui.images ; USING: accessors io.pathnames sequences ui.images ui.theme ;
IN: ui.gadgets.theme IN: ui.gadgets.theme
: theme-image ( name -- image-name ) : theme-image ( name -- image-name )
"vocab:ui/gadgets/theme/" prepend-path ".tiff" append <image-name> ; "vocab:ui/gadgets/theme/" prepend-path ".tiff" append <image-name> ;
: theme-font-colors ( gadget -- gadget )
[ content-background >>background text-color >>foreground ] change-font ;

View File

@ -1,31 +1,57 @@
! Copyright (C) 2016 Nicolas Pénet. ! Copyright (C) 2016 Nicolas Pénet.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: fry hashtables help.stylesheet help.tips io.styles USING: assocs fry hashtables help.stylesheet help.tips io.styles
kernel listener namespaces ui.theme ui.tools.listener ; kernel listener namespaces prettyprint.stylesheet sequences
ui.theme ui.tools.listener vocabs.prettyprint words ;
IN: ui.theme.switching IN: ui.theme.switching
: (update-style) ( style color elt -- ) : (update-style) ( style color elt -- )
'[ _ _ rot ?set-at ] change-global ; '[ _ _ rot ?set-at ] change-global ;
: update-stylesheet ( -- ) : update-stylesheet ( -- )
! help.stylesheet
default-span-style text-color foreground (update-style) default-span-style text-color foreground (update-style)
link-style link-color foreground (update-style) link-style link-color foreground (update-style)
title-style title-color foreground (update-style) title-style title-color foreground (update-style)
help-path-style help-path-border-color table-border (update-style)
heading-style heading-color foreground (update-style) heading-style heading-color foreground (update-style)
snippet-style snippet-color foreground (update-style) snippet-style snippet-color foreground (update-style)
code-style code-background-color page-color (update-style) code-style code-background-color page-color (update-style)
output-style output-color foreground (update-style) output-style output-color foreground (update-style)
url-style url-color foreground (update-style) url-style link-color foreground (update-style)
warning-style warning-background-color page-color (update-style) warning-style warning-background-color page-color (update-style)
deprecated-style warning-background-color page-color (update-style) warning-style warning-border-color border-color (update-style)
table-style line-color table-border (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)
stack-effect-style stack-effect-color foreground (update-style)
! listener
prompt-style prompt-background-color background (update-style) prompt-style prompt-background-color background (update-style)
prompt-style text-color foreground (update-style) prompt-style text-color foreground (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 ; ! vocabs.prettyprint
: dark-mode ( -- ) dark-theme theme set-global update-stylesheet ; manifest-style vocab-background-color page-color (update-style)
manifest-style vocab-border-color border-color (update-style) ;
light-mode : light-mode ( -- )
light-theme theme set-global update-stylesheet ;
: dark-mode ( -- )
dark-theme theme set-global update-stylesheet ;

View File

@ -63,8 +63,12 @@ HOOK: title-color theme ( -- color )
HOOK: heading-color theme ( -- color ) HOOK: heading-color theme ( -- color )
HOOK: snippet-color theme ( -- color ) HOOK: snippet-color theme ( -- color )
HOOK: output-color theme ( -- color ) HOOK: output-color theme ( -- color )
HOOK: deprecated-background-color theme ( -- color )
HOOK: deprecated-border-color theme ( -- color )
HOOK: warning-background-color theme ( -- color ) HOOK: warning-background-color theme ( -- color )
HOOK: warning-border-color theme ( -- color )
HOOK: code-background-color theme ( -- color ) HOOK: code-background-color theme ( -- color )
HOOK: help-path-border-color theme ( -- color )
HOOK: tip-background-color theme ( -- color ) HOOK: tip-background-color theme ( -- color )
@ -86,7 +90,10 @@ HOOK: focus-border-color theme ( -- color )
HOOK: labeled-border-color theme ( -- color ) HOOK: labeled-border-color theme ( -- color )
HOOK: table-border-color theme ( -- color )
SINGLETON: light-theme SINGLETON: light-theme
theme [ light-theme ] initialize
M: light-theme toolbar-background COLOR: grey95 ; M: light-theme toolbar-background COLOR: grey95 ;
M: light-theme toolbar-button-pressed-background COLOR: dark-gray ; M: light-theme toolbar-button-pressed-background COLOR: dark-gray ;
@ -141,22 +148,25 @@ M: light-theme content-background COLOR: white ;
M: light-theme text-color COLOR: black ; M: light-theme text-color COLOR: black ;
M: light-theme link-color COLOR: DodgerBlue4 ; M: light-theme link-color COLOR: DodgerBlue4 ;
M: light-theme url-color COLOR: DodgerBlue4 ;
M: light-theme title-color COLOR: gray20 ; M: light-theme title-color COLOR: gray20 ;
M: light-theme heading-color COLOR: FactorDarkSlateBlue ; M: light-theme heading-color COLOR: FactorDarkSlateBlue ;
M: light-theme snippet-color COLOR: solarized-orange ; M: light-theme snippet-color COLOR: DarkOrange4 ;
M: light-theme output-color COLOR: solarized-orange ; M: light-theme output-color COLOR: DarkOrange4 ;
M: light-theme warning-background-color T{ rgba f 1 0.7 0.7 1 } ; M: light-theme deprecated-background-color COLOR: gray90 ;
M: light-theme deprecated-border-color COLOR: red ;
M: light-theme warning-background-color COLOR: gray90 ;
M: light-theme warning-border-color COLOR: red ;
M: light-theme code-background-color COLOR: FactorLightTan ; M: light-theme code-background-color COLOR: FactorLightTan ;
M: light-theme help-path-border-color COLOR: FactorLightTan ;
M: light-theme tip-background-color COLOR: lavender ; M: light-theme tip-background-color COLOR: lavender ;
M: light-theme prompt-background-color T{ rgba f 1 0.7 0.7 1 } ; M: light-theme prompt-background-color T{ rgba f 1 0.7 0.7 1 } ;
M: light-theme dim-color COLOR: solarized-cyan ; M: light-theme dim-color COLOR: gray35 ;
M: light-theme highlighted-word-color COLOR: solarized-green ; M: light-theme highlighted-word-color COLOR: DarkSlateGray ;
M: light-theme string-color COLOR: solarized-magenta ; M: light-theme string-color COLOR: LightSalmon4 ;
M: light-theme stack-effect-color COLOR: solarized-orange ; M: light-theme stack-effect-color COLOR: FactorDarkGreen ;
M: light-theme vocab-background-color COLOR: FactorLightTan ; M: light-theme vocab-background-color COLOR: FactorLightTan ;
M: light-theme vocab-border-color COLOR: FactorDarkTan ; M: light-theme vocab-border-color COLOR: FactorDarkTan ;
@ -169,6 +179,8 @@ M: light-theme focus-border-color COLOR: dark-gray ;
M: light-theme labeled-border-color COLOR: grey85 ; M: light-theme labeled-border-color COLOR: grey85 ;
M: light-theme table-border-color COLOR: FactorTan ;
SINGLETON: dark-theme SINGLETON: dark-theme
M: dark-theme toolbar-background COLOR: solarized-base02 ; M: dark-theme toolbar-background COLOR: solarized-base02 ;
@ -224,13 +236,16 @@ M: dark-theme content-background COLOR: solarized-base03 ;
M: dark-theme text-color COLOR: grey75 ; M: dark-theme text-color COLOR: grey75 ;
M: dark-theme link-color COLOR: solarized-blue ; M: dark-theme link-color COLOR: solarized-blue ;
M: dark-theme url-color COLOR: solarized-blue ;
M: dark-theme title-color COLOR: grey75 ; M: dark-theme title-color COLOR: grey75 ;
M: dark-theme heading-color COLOR: grey75 ; M: dark-theme heading-color COLOR: grey75 ;
M: dark-theme snippet-color COLOR: solarized-orange ; M: dark-theme snippet-color COLOR: solarized-orange ;
M: dark-theme output-color COLOR: solarized-orange ; M: dark-theme output-color COLOR: solarized-orange ;
M: dark-theme deprecated-background-color HEXCOLOR: 6E2E32 ;
M: dark-theme deprecated-border-color COLOR: red ;
M: dark-theme warning-background-color HEXCOLOR: 6E2E32 ; M: dark-theme warning-background-color HEXCOLOR: 6E2E32 ;
M: dark-theme warning-border-color COLOR: red ;
M: dark-theme code-background-color HEXCOLOR: 2F4D5B ; M: dark-theme code-background-color HEXCOLOR: 2F4D5B ;
M: dark-theme help-path-border-color HEXCOLOR: 2F4D5B ;
M: dark-theme tip-background-color HEXCOLOR: 2F4D5B ; M: dark-theme tip-background-color HEXCOLOR: 2F4D5B ;
@ -252,4 +267,4 @@ M: dark-theme focus-border-color COLOR: solarized-base01 ;
M: dark-theme labeled-border-color COLOR: solarized-base01 ; M: dark-theme labeled-border-color COLOR: solarized-base01 ;
light-theme theme set-global M: dark-theme table-border-color COLOR: solarized-base01 ;

View File

@ -8,10 +8,10 @@ make models namespaces sequences sets ui ui.commands ui.gadgets
ui.gadgets.borders ui.gadgets.editors ui.gadgets.editors.private ui.gadgets.borders ui.gadgets.editors ui.gadgets.editors.private
ui.gadgets.glass ui.gadgets.labels ui.gadgets.labels.private ui.gadgets.glass ui.gadgets.labels ui.gadgets.labels.private
ui.gadgets.panes ui.gadgets.scrollers ui.gadgets.status-bar ui.gadgets.panes ui.gadgets.scrollers ui.gadgets.status-bar
ui.theme ui.gadgets.toolbar ui.gadgets.tracks ui.theme ui.gadgets.theme ui.gadgets.toolbar ui.gadgets.tracks
ui.gadgets.viewports ui.gadgets.worlds ui.gestures ui.pens.solid ui.gadgets.viewports ui.gadgets.worlds ui.gestures ui.pens.solid
ui.render ui.text ui.tools.browser.history ui.render ui.text ui.tools.common ui.tools.browser.history
ui.tools.browser.popups ui.tools.common vocabs ; ui.tools.browser.popups vocabs ;
IN: ui.tools.browser IN: ui.tools.browser
TUPLE: browser-gadget < tool history scroller search-field popup ; TUPLE: browser-gadget < tool history scroller search-field popup ;

View File

@ -5,7 +5,7 @@ definitions.icons fry help help.topics kernel math.rectangles
models.arrow namespaces sequences tools.crossref ui.gadgets models.arrow namespaces sequences tools.crossref ui.gadgets
ui.gadgets.glass ui.gadgets.labeled ui.gadgets.search-tables ui.gadgets.glass ui.gadgets.labeled ui.gadgets.search-tables
ui.gadgets.tables ui.gadgets.theme ui.gadgets.wrappers ui.gestures ui.images ui.gadgets.tables ui.gadgets.theme ui.gadgets.wrappers ui.gestures ui.images
ui.operations ui.pens.solid ; ui.operations ui.pens.solid ui.theme ;
FROM: ui.gadgets.wrappers => wrapper ; FROM: ui.gadgets.wrappers => wrapper ;
IN: ui.tools.browser.popups IN: ui.tools.browser.popups

View File

@ -49,6 +49,3 @@ SLOT: scroller
: white-interior ( track -- track ) : white-interior ( track -- track )
content-background <solid> >>interior ; content-background <solid> >>interior ;
: theme-font-colors ( gadget -- gadget )
[ content-background >>background text-color >>foreground ] change-font ;

View File

@ -7,7 +7,7 @@ ui.debugger ui.gestures ui.gadgets ui.pens.solid
ui.gadgets.worlds ui.gadgets.packs ui.gadgets.buttons ui.gadgets.worlds ui.gadgets.packs ui.gadgets.buttons
ui.gadgets.labels ui.gadgets.presentations ui.gadgets.panes ui.gadgets.labels ui.gadgets.presentations ui.gadgets.panes
ui.gadgets.viewports ui.gadgets.tables ui.theme ui.gadgets.viewports ui.gadgets.tables ui.theme
ui.gadgets.tracks ui.gadgets.toolbar ui.gadgets.theme ui.gadgets.tracks ui.gadgets.toolbar
ui.gadgets.scrollers ui.gadgets.borders ui.gadgets.status-bar ui.gadgets.scrollers ui.gadgets.borders ui.gadgets.status-bar
ui.tools.traceback ui.tools.inspector ui.tools.browser ui.tools.common ; ui.tools.traceback ui.tools.inspector ui.tools.browser ui.tools.common ;
IN: ui.tools.debugger IN: ui.tools.debugger

View File

@ -1,13 +1,14 @@
! Copyright (C) 2006, 2009 Slava Pestov. ! Copyright (C) 2006, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors colors inspector namespaces kernel models fry USING: accessors colors inspector namespaces kernel models fry
colors.constants models.arrow prettyprint sequences mirrors assocs colors.constants models.arrow prettyprint sequences mirrors
classes io io.styles arrays hashtables math.order sorting refs fonts assocs classes io io.styles arrays hashtables math.order sorting
ui.tools.browser ui.commands ui.operations ui.gadgets ui.gadgets.panes refs fonts ui.tools.browser ui.commands ui.operations ui.gadgets
ui.gadgets.scrollers ui.gadgets.slots ui.gadgets.tracks ui.gestures ui.gadgets.panes ui.gadgets.scrollers ui.gadgets.slots
ui.gadgets.buttons ui.gadgets.tables ui.theme ui.gadgets.theme ui.gadgets.tracks ui.gestures
ui.gadgets.toolbar ui.gadgets.status-bar ui.gadgets.buttons ui.gadgets.tables ui.theme ui.gadgets.toolbar
ui.gadgets.labeled ui.tools.common ui combinators ui.gadgets.worlds ; ui.gadgets.status-bar ui.gadgets.labeled ui.tools.common ui
combinators ui.gadgets.worlds ;
IN: ui.tools.inspector IN: ui.tools.inspector
TUPLE: inspector-gadget < tool table ; TUPLE: inspector-gadget < tool table ;

View File

@ -9,7 +9,7 @@ ui.gadgets ui.gadgets.editors ui.gadgets.glass
ui.gadgets.labeled ui.gadgets.scrollers ui.gadgets.tables ui.gadgets.labeled ui.gadgets.scrollers ui.gadgets.tables
ui.gadgets.theme ui.gadgets.tracks ui.gadgets.worlds ui.gadgets.theme ui.gadgets.tracks ui.gadgets.worlds
ui.gadgets.wrappers ui.gestures ui.images ui.operations ui.gadgets.wrappers ui.gestures ui.images ui.operations
ui.pens.solid ui.tools.common ui.tools.listener.history ui.pens.solid ui.theme ui.tools.common ui.tools.listener.history
ui.tools.listener.popups vocabs words ; ui.tools.listener.popups vocabs words ;
IN: ui.tools.listener.completion IN: ui.tools.listener.completion

View File

@ -10,6 +10,7 @@ prettyprint sequences source-files.errors strings system threads
tools.errors.model ui ui.commands ui.gadgets ui.gadgets.editors tools.errors.model ui ui.commands ui.gadgets ui.gadgets.editors
ui.gadgets.glass ui.gadgets.labeled ui.gadgets.panes ui.gadgets.glass ui.gadgets.labeled ui.gadgets.panes
ui.gadgets.scrollers ui.gadgets.status-bar ui.theme ui.gadgets.scrollers ui.gadgets.status-bar ui.theme
ui.gadgets.theme
ui.gadgets.toolbar ui.gadgets.tracks ui.gestures ui.operations ui.gadgets.toolbar ui.gadgets.tracks ui.gestures ui.operations
ui.pens.solid ui.tools.browser ui.tools.common ui.tools.debugger ui.pens.solid ui.tools.browser ui.tools.common ui.tools.debugger
ui.tools.error-list ui.tools.listener.completion ui.tools.error-list ui.tools.listener.completion

View File

@ -5,7 +5,7 @@ kernel models models.arrow prettyprint sequences ui.commands
ui.gadgets ui.gadgets.borders ui.gadgets.buttons ui.gadgets ui.gadgets.borders ui.gadgets.buttons
ui.gadgets.labeled ui.gadgets.panes ui.gadgets.scrollers ui.gadgets.labeled ui.gadgets.panes ui.gadgets.scrollers
ui.gadgets.status-bar ui.gadgets.tables ui.gadgets.toolbar ui.gadgets.status-bar ui.gadgets.tables ui.gadgets.toolbar
ui.theme ui.gadgets.tracks ui.theme ui.gadgets.theme ui.gadgets.tracks
ui.gestures ui.tools.common ; ui.gestures ui.tools.common ;
QUALIFIED-WITH: ui.tools.inspector i QUALIFIED-WITH: ui.tools.inspector i
IN: ui.tools.traceback IN: ui.tools.traceback

View File

@ -1,9 +1,8 @@
! Copyright (C) 2009 Slava Pestov. ! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays assocs colors fry io USING: accessors assocs colors.constants fry io io.styles kernel
io.styles kernel literals make math.order namespaces parser make namespaces parser prettyprint.backend prettyprint.sections
prettyprint.backend prettyprint.sections prettyprint.stylesheet prettyprint.stylesheet sequences sorting vocabs vocabs.parser ;
sequences sets sorting ui.theme vocabs vocabs.parser ;
FROM: io.styles => inset ; FROM: io.styles => inset ;
IN: vocabs.prettyprint IN: vocabs.prettyprint
@ -83,6 +82,12 @@ PRIVATE>
: pprint-manifest ( manifest -- ) : pprint-manifest ( manifest -- )
(pprint-manifest pprint-manifest) ; (pprint-manifest pprint-manifest) ;
CONSTANT: manifest-style H{
{ page-color COLOR: FactorLightTan }
{ border-color COLOR: FactorDarkTan }
{ inset { 5 5 } }
}
[ [
nl nl
{ { font-style bold } { font-name "sans-serif" } } [ { { font-style bold } { font-name "sans-serif" } } [
@ -90,10 +95,6 @@ PRIVATE>
"To avoid doing this in the future, add the following forms" print "To avoid doing this in the future, add the following forms" print
"at the top of the source file:" print nl "at the top of the source file:" print nl
] with-style ] with-style
{ manifest-style [ manifest get pprint-manifest ] with-nesting
{ page-color $ vocab-background-color }
{ border-color $ vocab-border-color }
{ inset { 5 5 } }
} [ manifest get pprint-manifest ] with-nesting
nl nl nl nl
] print-use-hook set-global ] print-use-hook set-global