Reverting a change to the order of how Selected is applied to themes
This commit is contained in:
31
rtv/theme.py
31
rtv/theme.py
@@ -54,9 +54,9 @@ class Theme(object):
|
||||
# can only use the 8 basic colors with the default color as the background
|
||||
DEFAULT_THEME = {
|
||||
'modifiers': {
|
||||
'Normal': (-1, -1, None),
|
||||
'Selected': (None, None, None),
|
||||
'SelectedCursor': (None, None, curses.A_REVERSE),
|
||||
'Normal': (-1, -1, curses.A_NORMAL),
|
||||
'Selected': (-1, -1, curses.A_NORMAL),
|
||||
'SelectedCursor': (-1, -1, curses.A_REVERSE),
|
||||
},
|
||||
'page': {
|
||||
'TitleBar': (curses.COLOR_CYAN, None, curses.A_BOLD | curses.A_REVERSE),
|
||||
@@ -160,6 +160,18 @@ class Theme(object):
|
||||
elements[key] = (None, None, None)
|
||||
|
||||
self._set_fallback(elements, 'Normal', (-1, -1, curses.A_NORMAL))
|
||||
self._set_fallback(elements, 'Selected', 'Normal')
|
||||
self._set_fallback(elements, 'SelectedCursor', 'Normal')
|
||||
|
||||
# Create the "Selected" versions of elements, which are prefixed with
|
||||
# the @ symbol. For example, "@CommentText" represents how comment
|
||||
# text is formatted when it is highlighted by the cursor.
|
||||
for name in self.DEFAULT_THEME['normal']:
|
||||
dest = '@{0}'.format(name)
|
||||
self._set_fallback(elements, name, 'Selected', dest)
|
||||
for name in self.DEFAULT_THEME['cursor']:
|
||||
dest = '@{0}'.format(name)
|
||||
self._set_fallback(elements, name, 'SelectedCursor', dest)
|
||||
|
||||
# Fill in the ``None`` values for all of the elements with normal text
|
||||
for name in self.DEFAULT_THEME['normal']:
|
||||
@@ -169,19 +181,6 @@ class Theme(object):
|
||||
for name in self.DEFAULT_THEME['page']:
|
||||
self._set_fallback(elements, name, 'Normal')
|
||||
|
||||
# Create the "Selected" versions of elements, which are prefixed with
|
||||
# the @ symbol. For example, "@CommentText" represents how comment
|
||||
# text is formatted when it is highlighted by the cursor.
|
||||
for name in self.DEFAULT_THEME['normal']:
|
||||
dest = '@{0}'.format(name)
|
||||
self._set_fallback(elements, 'Selected', name, dest)
|
||||
for name in self.DEFAULT_THEME['cursor']:
|
||||
dest = '@{0}'.format(name)
|
||||
self._set_fallback(elements, 'SelectedCursor', name, dest)
|
||||
|
||||
self._set_fallback(elements, 'Selected', 'Normal')
|
||||
self._set_fallback(elements, 'SelectedCursor', 'Normal')
|
||||
|
||||
self.elements = elements
|
||||
|
||||
if self.use_color:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[theme]
|
||||
;<element> = <foreground> <background> <attributes>
|
||||
Normal = default default -
|
||||
Selected = - - -
|
||||
SelectedCursor = - - reverse
|
||||
Normal = default default normal
|
||||
Selected = default default normal
|
||||
SelectedCursor = default default reverse
|
||||
|
||||
TitleBar = cyan - bold+reverse
|
||||
OrderBar = yellow - bold
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
|
||||
[theme]
|
||||
;<element> = <foreground> <background> <attributes>
|
||||
Normal = ansi_252 ansi_234 -
|
||||
Selected = - ansi_236 -
|
||||
SelectedCursor = - - bold+reverse
|
||||
Normal = ansi_252 ansi_234 normal
|
||||
Selected = ansi_252 ansi_236 normal
|
||||
SelectedCursor = ansi_252 ansi_234 bold+reverse
|
||||
|
||||
TitleBar = ansi_81 - bold+reverse
|
||||
OrderBar = ansi_244 ansi_235 -
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
|
||||
[theme]
|
||||
;<element> = <foreground> <background> <attributes>
|
||||
Normal = ansi_238 ansi_255 -
|
||||
Selected = - ansi_254 -
|
||||
SelectedCursor = - - bold+reverse
|
||||
Normal = ansi_238 ansi_255 normal
|
||||
Selected = ansi_238 ansi_254 normal
|
||||
SelectedCursor = ansi_238 ansi_255 bold+reverse
|
||||
|
||||
TitleBar = ansi_24 - bold+reverse
|
||||
OrderBar = ansi_25 - bold
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
|
||||
[theme]
|
||||
;<element> = <foreground> <background> <attributes>
|
||||
Normal = ansi_244 ansi_234 -
|
||||
Selected = - ansi_235 -
|
||||
SelectedCursor = - ansi_235 bold+reverse
|
||||
Normal = ansi_244 ansi_234 normal
|
||||
Selected = ansi_244 ansi_235 normal
|
||||
SelectedCursor = ansi_244 ansi_235 bold+reverse
|
||||
|
||||
TitleBar = ansi_37 - bold+reverse
|
||||
OrderBar = ansi_245 - bold
|
||||
@@ -34,10 +34,10 @@ NoticeError = ansi_160 - bold
|
||||
NoticeSuccess = ansi_64 - bold
|
||||
|
||||
CursorBlock = ansi_240 - -
|
||||
CursorBar1 = ansi_125 - bold
|
||||
CursorBar2 = ansi_160 - bold
|
||||
CursorBar3 = ansi_61 - bold
|
||||
CursorBar4 = ansi_37 - bold
|
||||
CursorBar1 = ansi_125 - -
|
||||
CursorBar2 = ansi_160 - -
|
||||
CursorBar3 = ansi_61 - -
|
||||
CursorBar4 = ansi_37 - -
|
||||
|
||||
CommentAuthor = ansi_33 - bold
|
||||
CommentAuthorSelf = ansi_64 - bold
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
|
||||
[theme]
|
||||
;<element> = <foreground> <background> <attributes>
|
||||
Normal = ansi_241 ansi_230 -
|
||||
Selected = - ansi_254 -
|
||||
SelectedCursor = - ansi_254 bold+reverse
|
||||
Normal = ansi_241 ansi_230 normal
|
||||
Selected = ansi_241 ansi_254 normal
|
||||
SelectedCursor = ansi_241 ansi_254 bold+reverse
|
||||
|
||||
TitleBar = ansi_37 - bold+reverse
|
||||
OrderBar = ansi_245 - bold
|
||||
@@ -34,10 +34,10 @@ NoticeError = ansi_160 - bold
|
||||
NoticeSuccess = ansi_64 - bold
|
||||
|
||||
CursorBlock = ansi_245 - -
|
||||
CursorBar1 = ansi_125 - bold
|
||||
CursorBar2 = ansi_160 - bold
|
||||
CursorBar3 = ansi_61 - bold
|
||||
CursorBar4 = ansi_37 - bold
|
||||
CursorBar1 = ansi_125 - -
|
||||
CursorBar2 = ansi_160 - -
|
||||
CursorBar3 = ansi_61 - -
|
||||
CursorBar4 = ansi_37 - -
|
||||
|
||||
CommentAuthor = ansi_33 - bold
|
||||
CommentAuthorSelf = ansi_64 - bold
|
||||
|
||||
@@ -102,7 +102,11 @@ def test_theme_element_selected_attributes():
|
||||
# the ones defined in "Selected". Because "Selected" defines
|
||||
# a foreground and a background color, they will override the
|
||||
# ones that "Link" had defined.
|
||||
assert theme.elements['@Link'] == (2, 3, curses.A_REVERSE)
|
||||
# assert theme.elements['@Link'] == (2, 3, curses.A_REVERSE)
|
||||
|
||||
# I can't remember why the above rule was implemented, so I reverted it
|
||||
assert theme.elements['@Link'] == (5, 3, curses.A_REVERSE)
|
||||
|
||||
assert '@Normal' not in theme.elements
|
||||
assert '@Selected' not in theme.elements
|
||||
assert '@TitleBar' not in theme.elements
|
||||
|
||||
Reference in New Issue
Block a user