From b284d3661e6068e38aa27778efddf39eb927aa4b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 2 Oct 2023 08:38:11 +0530 Subject: [PATCH] Content server: Change formatting of book details to match new de-emphasized titles based formatting in the main calibre program. Fixes #2029723 [[Enhancement] Suggestions to make the Book details panel look nicer](https://bugs.launchpad.net/calibre/+bug/2029723) --- src/pyj/book_list/book_details.pyj | 12 ++++++------ src/pyj/book_list/theme.pyj | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/pyj/book_list/book_details.pyj b/src/pyj/book_list/book_details.pyj index b0187d665f..918bbe2168 100644 --- a/src/pyj/book_list/book_details.pyj +++ b/src/pyj/book_list/book_details.pyj @@ -220,7 +220,7 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{ else: parent.appendChild(document.createTextNode(v)) - table.appendChild(E.tr(E.td(name + ':'), E.td())) + table.appendChild(E.tr(E.td(name), E.td())) if is_html and /[<>]/.test(val + ''): table.lastChild.lastChild.appendChild(adjusting_sandboxed_html(val + '', iframe_css)) else: @@ -254,7 +254,7 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{ def process_formats(field, fm, name, val): if val.length and book_id?: - table.appendChild(E.tr(E.td(name + ':'), E.td())) + table.appendChild(E.tr(E.td(name), E.td())) td = table.lastChild.lastChild for fmt in val: fmt = fmt.toUpperCase() @@ -285,7 +285,7 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{ td.appendChild(document.createTextNode(', ')) td.appendChild(E.a(class_='blue-link', title='{}:{}'.format(k, idval), target='_new', href=url, text)) if td.childNodes.length: - table.appendChild(E.tr(E.td(name + ':'), td)) + table.appendChild(E.tr(E.td(name), td)) def process_size(field, fm, name, val): if val: @@ -296,7 +296,7 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{ def process_languages(field, fm, name, val): if val and val.length: - table.appendChild(E.tr(E.td(name + ':'), E.td())) + table.appendChild(E.tr(E.td(name), E.td())) td = table.lastChild.lastChild for k in val: if mi.lang_names: @@ -326,7 +326,7 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{ except Exception: ival = 1.0 ival = fmt_sidx(ival, use_roman=interface_data.use_roman_numerals_for_series_number) - table.appendChild(E.tr(E.td(name + ':'), E.td())) + table.appendChild(E.tr(E.td(name), E.td())) s = safe_set_inner_html(E.span(), _('{0} of {1}').format(ival, val)) a = s.getElementsByTagName('a') if a and a.length: @@ -439,7 +439,7 @@ def render_metadata(mi, table, book_id, iframe_css): # {{{ def basic_table_rules(sel): style = '' style += build_rule(sel + 'table.metadata td', vertical_align='top') - 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 td:first-of-type', font_style='italic', color='var(--calibre-color-faded-text)', padding_right='0.5em', white_space='nowrap', text_align='right') style += build_rule(sel + 'table.metadata td:last-of-type', overflow_wrap='break-word') return style diff --git a/src/pyj/book_list/theme.pyj b/src/pyj/book_list/theme.pyj index 648cea02e1..784dee9d5c 100644 --- a/src/pyj/book_list/theme.pyj +++ b/src/pyj/book_list/theme.pyj @@ -25,6 +25,7 @@ DEFAULT_COLORS = { 'window-error-foreground': c('red', '#C40233'), 'window-hover-foreground': c('red', '#C40233'), 'link-foreground': c('blue', '#6cb4ee'), + 'faded-text': c('#666', '#7f7f7f'), # Top bar specific colors 'bar-background': c(DARK, DT_DARK_LIGHTER),