make the caret color themeable

handle-patch-and-put
Pi 2017-10-24 18:18:59 -07:00 committed by John Benediktsson
parent a51fd04d0b
commit 7c383a52ba
3 changed files with 6 additions and 7 deletions

View File

@ -12,7 +12,6 @@ HELP: editor
$nl $nl
"Editors have the following slots:" "Editors have the following slots:"
{ $list { $list
{ { $snippet "caret-color" } " - a " { $link color } "." }
{ { $snippet "caret" } " - a " { $link model } " storing a line/column pair." } { { $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 "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." } { { $snippet "focused?" } " - a boolean." }

View File

@ -25,7 +25,6 @@ TUPLE: editor < line-gadget
<loc> >>mark ; inline <loc> >>mark ; inline
: editor-theme ( editor -- editor ) : editor-theme ( editor -- editor )
COLOR: red >>caret-color
monospace-font >>font ; inline monospace-font >>font ; inline
PRIVATE> PRIVATE>
@ -158,11 +157,9 @@ M: editor ungraft*
: draw-caret ( editor -- ) : draw-caret ( editor -- )
dup draw-caret? [ dup draw-caret? [
[ caret-color>> gl-color ] [ editor-caret-color gl-color ] dip
[ [ caret-loc ] [ caret-dim ] bi
[ caret-loc ] [ caret-dim ] bi over v+ gl-line
over v+ gl-line
] bi
] [ drop ] if ; ] [ drop ] if ;
: selection-start/end ( editor -- start end ) : selection-start/end ( editor -- start end )

View File

@ -83,6 +83,7 @@ HOOK: vocab-border-color theme ( -- color )
HOOK: field-border-color theme ( -- color ) HOOK: field-border-color theme ( -- color )
HOOK: editor-caret-color theme ( -- color )
HOOK: selection-color theme ( -- color ) HOOK: selection-color theme ( -- color )
HOOK: panel-background-color theme ( -- color ) HOOK: panel-background-color theme ( -- color )
HOOK: focus-border-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 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 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 panel-background-color T{ rgba f 0.7843 0.7686 0.7176 1.0 } ;
M: light-theme focus-border-color COLOR: dark-gray ; 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 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 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 panel-background-color T{ rgba f 0.7843 0.7686 0.7176 1.0 } ;
M: dark-theme focus-border-color COLOR: solarized-base01 ; M: dark-theme focus-border-color COLOR: solarized-base01 ;