From cb7f5726ebe6939881a4ccabee946f140cc14183 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 16 May 2017 10:40:59 +0530 Subject: [PATCH] ... --- src/pyj/book_list/book_details.pyj | 34 ++++++++++++++++----------- src/pyj/book_list/search.pyj | 4 ++-- src/pyj/book_list/theme.pyj | 1 + src/pyj/read_book/overlay.pyj | 2 +- src/pyj/read_book/prefs/font_size.pyj | 2 +- src/pyj/read_book/view.pyj | 2 +- src/pyj/widgets.pyj | 6 ++--- 7 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/pyj/book_list/book_details.pyj b/src/pyj/book_list/book_details.pyj index 8354ce3b12..0c64441ae6 100644 --- a/src/pyj/book_list/book_details.pyj +++ b/src/pyj/book_list/book_details.pyj @@ -3,22 +3,28 @@ from __python__ import hash_literals import traceback -from ajax import ajax -from book_list.theme import get_font_size -from dom import clear, build_rule, svgicon, add_extra_css from elementmaker import E from gettext import gettext as _ -from modals import error_dialog, create_custom_dialog -from widgets import create_spinner, create_button -from date import format_date -from session import get_interface_data -from utils import fmt_sidx, parse_url_params, conditional_timeout, safe_set_inner_html, sandboxed_html, debounce -from book_list.router import back, open_book, home -from book_list.library_data import book_metadata, cover_url, set_book_metadata, current_library_id, library_data, download_url, load_status, current_virtual_library -from book_list.top_bar import create_top_bar, set_title, add_button -from book_list.ui import set_panel_handler, query_as_href +from ajax import ajax +from book_list.library_data import ( + book_metadata, cover_url, current_library_id, current_virtual_library, + download_url, library_data, load_status, set_book_metadata +) +from book_list.router import back, home, open_book +from book_list.theme import get_color, get_font_size +from book_list.top_bar import add_button, create_top_bar, set_title +from book_list.ui import query_as_href, set_panel_handler from book_list.views import search_query_for +from date import format_date +from dom import add_extra_css, build_rule, clear, svgicon +from modals import create_custom_dialog, error_dialog +from session import get_interface_data +from utils import ( + conditional_timeout, debounce, fmt_sidx, parse_url_params, safe_set_inner_html, + sandboxed_html +) +from widgets import create_button, create_spinner bd_counter = 0 @@ -306,8 +312,8 @@ add_extra_css(def(): sel = '.' + CLASS_NAME + ' ' style = build_rule(sel + 'table.metadata td:first-of-type', font_weight='bold', padding_right='1em', white_space='nowrap') style += build_rule(sel + 'table.metadata a[href]', color='blue') - style += build_rule(sel + 'table.metadata a[href]:hover', color='red') - style += build_rule(sel + 'table.metadata a[href]:active', color='red', transform='scale(1.5)') + style += build_rule(sel + 'table.metadata a[href]:hover', color=get_color('window-hover-foreground')) + style += build_rule(sel + 'table.metadata a[href]:active', color=get_color('window-hover-foreground'), transform='scale(1.5)') return style ) diff --git a/src/pyj/book_list/search.pyj b/src/pyj/book_list/search.pyj index fe3da1595d..38df38a995 100644 --- a/src/pyj/book_list/search.pyj +++ b/src/pyj/book_list/search.pyj @@ -39,12 +39,12 @@ add_extra_css(def(): # search items list style += build_rule(sel + ' ul.search-items', margin_top='1ex', list_style_type='none', text_align='left') style += build_rule(sel + ' ul.search-items > li', display='inline-block', cursor='pointer', background_color=get_color('window-background2'), border_radius='10px', padding='0.5ex', margin_right='1em') - style += build_rule(sel + ' ul.search-items > li:hover', color='red') + style += build_rule(sel + ' ul.search-items > li:hover', color=get_color('window-hover-foreground')) style += build_rule(sel + ' ul.search-items > li:active', transform='scale(1.5)') # Actions popup style += build_rule('#modal-container ul.tb-action-list > li:hover', color=get_color('list-hover-foreground'), background_color=get_color('list-hover-background')) - style += build_rule('#modal-container ul.tb-action-list > li:active', color='red', color=get_color('list-hover-foreground'), background_color=get_color('list-hover-background')) + style += build_rule('#modal-container ul.tb-action-list > li:active', color=get_color('window-hover-foreground'), color=get_color('list-hover-foreground'), background_color=get_color('list-hover-background')) return style ) diff --git a/src/pyj/book_list/theme.pyj b/src/pyj/book_list/theme.pyj index 7bc2343b8f..8a3c6e985f 100644 --- a/src/pyj/book_list/theme.pyj +++ b/src/pyj/book_list/theme.pyj @@ -14,6 +14,7 @@ def get_color(name): 'window-background2': LIGHT_DARKER, 'window-foreground': DARK, 'window-error-foreground': 'red', + 'window-hover-foreground': 'red', # Top bar specific colors 'bar-background': DARK, diff --git a/src/pyj/read_book/overlay.pyj b/src/pyj/read_book/overlay.pyj index 9a2d505b3c..41adad705b 100644 --- a/src/pyj/read_book/overlay.pyj +++ b/src/pyj/read_book/overlay.pyj @@ -173,7 +173,7 @@ add_extra_css(def(): sel += '> li' style += build_rule(sel, border_right='1px solid currentColor', padding='0.5em 1ex', display='flex', align_items='center', cursor='pointer') style += build_rule(sel + ':last-child', border_right_style='none') - style += build_rule(sel + ':hover > *:first-child', color='red') + style += build_rule(sel + ':hover > *:first-child', color=get_color('window-hover-foreground')) style += build_rule(sel + ':active > *:first-child', transform='scale(1.8)') return style ) diff --git a/src/pyj/read_book/prefs/font_size.pyj b/src/pyj/read_book/prefs/font_size.pyj index 1dba1ddfb2..f8e397f0a4 100644 --- a/src/pyj/read_book/prefs/font_size.pyj +++ b/src/pyj/read_book/prefs/font_size.pyj @@ -15,7 +15,7 @@ QUICK = unique_id('quick') add_extra_css(def(): style = rule(QUICK, 'li.current', background_color=get_color('window-background2')) style += rule(QUICK, 'li:hover', background_color=get_color('window-background2')) - style += rule(CONTAINER, 'a:hover', color='red') + style += rule(CONTAINER, 'a:hover', color=get_color('window-hover-foreground')) return style ) diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index f9d555b5ee..299779e701 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -47,7 +47,7 @@ add_extra_css(def(): sel = '.book-side-margin' ans = build_rule(sel, cursor='pointer', color='rgba(0, 0, 0, 0)', text_align='center', height='100vh', user_select='none', display='flex', align_items='center', justify_content='center') ans += build_rule(sel + ':hover', background_color=get_color('window-background') + ' !important', color=get_color('window-foreground') + ' !important') - ans += build_rule(sel + ':active > svg', color='red', transform='scale(2)') + ans += build_rule(sel + ':active > svg', color=get_color('window-hover-foreground'), transform='scale(2)') return ans ) diff --git a/src/pyj/widgets.pyj b/src/pyj/widgets.pyj index ea3b78e791..3b62641caf 100644 --- a/src/pyj/widgets.pyj +++ b/src/pyj/widgets.pyj @@ -63,9 +63,9 @@ class Breadcrumbs: padding='0.5ex 1rem', position='relative' ) - STYLE_RULES += build_rule('.calibre-breadcrumbs > li:hover', color='red') + STYLE_RULES += build_rule('.calibre-breadcrumbs > li:hover', color=get_color('window-hover-foreground')) - STYLE_RULES += build_rule('.calibre-breadcrumbs > li:active', color='red', transform='scale(1.5)') + STYLE_RULES += build_rule('.calibre-breadcrumbs > li:active', color=get_color('window-hover-foreground'), transform='scale(1.5)') STYLE_RULES += build_rule( '.calibre-breadcrumbs > li:before, .calibre-breadcrumbs > li:after', @@ -205,7 +205,7 @@ def scroll_tree_item_into_view(item): add_extra_css(def(): ans = 'a, button:focus { outline: none }; a, button::-moz-focus-inner { border: 0 }\n' - ans += '.simple-link { cursor: pointer } .simple-link:hover { color: red } .simple-link:active { transform: scale(1.5) }\n' + ans += '.simple-link { cursor: pointer } .simple-link:hover { color: HC } .simple-link:active { transform: scale(1.5) }\n'.replace('HC', get_color('window-hover-foreground')) ans += create_button.style + '\n' ans += create_spinner.style + '\n' ans += Breadcrumbs.STYLE_RULES + '\n'