]> gitweb.factorcode.org Git - factor.git/commitdiff
make the caret color themeable
authorPi <pi+git@pihost.us>
Wed, 25 Oct 2017 01:18:59 +0000 (18:18 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 7 Sep 2018 17:02:25 +0000 (10:02 -0700)
basis/ui/gadgets/editors/editors-docs.factor
basis/ui/gadgets/editors/editors.factor
basis/ui/theme/theme.factor

index dcbbced158bbbe2c916f67d26a9f1a81133cfc0c..3517d574515739ef67ff5e26315f16e16ca48edf 100644 (file)
@@ -12,7 +12,6 @@ HELP: editor
 $nl
 "Editors have the following slots:"
 { $list
-    { { $snippet "caret-color" } " - a " { $link color } "." }
     { { $snippet "caret" } " - a " { $link model } " storing a line/column pair." }
     { { $snippet "mark" } " - a " { $link model } " storing a line/column pair. If there is no selection, the mark is equal to the caret, otherwise the mark is located at the opposite end of the selection from the caret." }
     { { $snippet "focused?" } " - a boolean." }
index 74ffbd46954689ba97ad3757afb0e66a2c022c2c..76e0c64d093452cee26f4dcc4d3030b20afb2cec 100644 (file)
@@ -25,7 +25,6 @@ TUPLE: editor < line-gadget
     <loc> >>mark ; inline
 
 : editor-theme ( editor -- editor )
-    COLOR: red >>caret-color
     monospace-font >>font ; inline
 
 PRIVATE>
@@ -158,11 +157,9 @@ M: editor ungraft*
 
 : draw-caret ( editor -- )
     dup draw-caret? [
-        [ caret-color>> gl-color ]
-        [
-            [ caret-loc ] [ caret-dim ] bi
-            over v+ gl-line
-        ] bi
+        [ editor-caret-color gl-color ] dip
+        [ caret-loc ] [ caret-dim ] bi
+        over v+ gl-line
     ] [ drop ] if ;
 
 : selection-start/end ( editor -- start end )
index e00382b9c70cee81e3f5114cb06566b93967d967..4f1b3eb121922f369ebb6433a6f16fceb64ba190 100644 (file)
@@ -83,6 +83,7 @@ HOOK: vocab-border-color theme ( -- color )
 
 HOOK: field-border-color theme ( -- color )
 
+HOOK: editor-caret-color theme ( -- color )
 HOOK: selection-color theme ( -- color )
 HOOK: panel-background-color theme ( -- color )
 HOOK: focus-border-color theme ( -- color )
@@ -172,6 +173,7 @@ M: light-theme vocab-border-color COLOR: FactorDarkTan ;
 
 M: light-theme field-border-color COLOR: gray ;
 
+M: light-theme editor-caret-color COLOR: red ;
 M: light-theme selection-color T{ rgba f 0.8 0.8 1.0 1.0 } ;
 M: light-theme panel-background-color T{ rgba f 0.7843 0.7686 0.7176 1.0 } ;
 M: light-theme focus-border-color COLOR: dark-gray ;
@@ -260,6 +262,7 @@ M: dark-theme vocab-border-color COLOR: solarized-base01 ;
 
 M: dark-theme field-border-color COLOR: solarized-base01 ;
 
+M: dark-theme editor-caret-color COLOR: red ;
 M: dark-theme selection-color COLOR: solarized-base01 ;
 M: dark-theme panel-background-color T{ rgba f 0.7843 0.7686 0.7176 1.0 } ;
 M: dark-theme focus-border-color COLOR: solarized-base01 ;