This commit is contained in:
Kovid Goyal 2017-05-16 10:40:59 +05:30
parent 02b67f82b9
commit cb7f5726eb
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
7 changed files with 29 additions and 22 deletions

View File

@ -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
)

View File

@ -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
)

View File

@ -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,

View File

@ -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
)

View File

@ -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
)

View File

@ -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
)

View File

@ -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'