From: Pi Date: Wed, 25 Oct 2017 01:18:59 +0000 (-0700) Subject: make the caret color themeable X-Git-Tag: 0.99~4029 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=7c383a52ba7bdb00819abf54df87e991a58cbbdf make the caret color themeable --- diff --git a/basis/ui/gadgets/editors/editors-docs.factor b/basis/ui/gadgets/editors/editors-docs.factor index dcbbced158..3517d57451 100644 --- a/basis/ui/gadgets/editors/editors-docs.factor +++ b/basis/ui/gadgets/editors/editors-docs.factor @@ -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." } diff --git a/basis/ui/gadgets/editors/editors.factor b/basis/ui/gadgets/editors/editors.factor index 74ffbd4695..76e0c64d09 100644 --- a/basis/ui/gadgets/editors/editors.factor +++ b/basis/ui/gadgets/editors/editors.factor @@ -25,7 +25,6 @@ TUPLE: editor < line-gadget >>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 ) diff --git a/basis/ui/theme/theme.factor b/basis/ui/theme/theme.factor index e00382b9c7..4f1b3eb121 100644 --- a/basis/ui/theme/theme.factor +++ b/basis/ui/theme/theme.factor @@ -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 ;