$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." }
<loc> >>mark ; inline
: editor-theme ( editor -- editor )
- COLOR: red >>caret-color
monospace-font >>font ; inline
PRIVATE>
: 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 )
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 )
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 ;
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 ;