Make the cursor easier to see.

This commit is contained in:
Andrew Hamilton 2016-10-24 22:06:27 +02:00
parent bf856d87f0
commit 2b351efe20
2 changed files with 9 additions and 4 deletions

View file

@ -68,6 +68,13 @@ _STATUS_TO_TERMSTR = {
_STATUS_TO_TERMSTR[Status.error] = termstr.TermStr( _STATUS_TO_TERMSTR[Status.error] = termstr.TermStr(
"E", termstr.CharStyle(bg_color=termstr.Color.red)) "E", termstr.CharStyle(bg_color=termstr.Color.red))
_STATUS_TO_TERMSTR[Status.pending] = "." _STATUS_TO_TERMSTR[Status.pending] = "."
STATUS_CURSOR_COLORS = {Status.ok: termstr.Color.black,
Status.problem: termstr.Color.white,
Status.normal: termstr.Color.black,
Status.not_applicable: termstr.Color.white,
Status.running: termstr.Color.white,
Status.paused: termstr.Color.black,
Status.timed_out: termstr.Color.white}
def get_ls_color_codes(): def get_ls_color_codes():

6
vigil
View file

@ -104,10 +104,8 @@ class Entry(collections.UserList):
result_selected = self.widget[self.highlighted] result_selected = self.widget[self.highlighted]
status_color = tools._STATUS_COLORS.get( status_color = tools._STATUS_COLORS.get(
result_selected.status, None) result_selected.status, None)
fg_color = (termstr.Color.white fg_color = tools.STATUS_CURSOR_COLORS.get(result_selected.status,
if (status_color is None or termstr.Color.white)
(sum(status_color) / 3) < (255 / 2))
else termstr.Color.black)
return fill3.Text(termstr.TermStr("+", termstr.CharStyle( return fill3.Text(termstr.TermStr("+", termstr.CharStyle(
fg_color=fg_color, bg_color=status_color))) fg_color=fg_color, bg_color=status_color)))