From 8f0982ae33b30748be32a049a5d6a06550a852fd Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Wed, 7 May 2025 00:16:00 +0800 Subject: [PATCH] fix: replace bg color only for non-default theme color, closes #1049 (#1053) --- apps/readest-app/src/utils/style.ts | 10 +++++----- packages/foliate-js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/readest-app/src/utils/style.ts b/apps/readest-app/src/utils/style.ts index 8d038dbe..a292994f 100644 --- a/apps/readest-app/src/utils/style.ts +++ b/apps/readest-app/src/utils/style.ts @@ -87,12 +87,12 @@ const getFontStyles = ( body * { ${overrideFont ? 'font-family: revert !important;' : ''} } - a:any-link { + a:any-link * { ${overrideFont ? `color: ${primary};` : ''} } /* https://github.com/whatwg/html/issues/5426 */ @media (prefers-color-scheme: dark) { - a:link { + a:link * { ${overrideFont ? `color: ${primary};` : `color: lightblue;`} } } @@ -213,7 +213,7 @@ const getLayoutStyles = ( background-color: var(--theme-bg-color, transparent); background: var(--background-set, none); } - body *:not(a):not(#b1):not(#b1 *):not(#b2):not(#b2 *):not(img):not(.bg):not(.bg *):not(.vol):not(.vol *):not(.background):not(.background *) { + body.pbg, body *:not(a):not(#b1):not(#b1 *):not(#b2):not(#b2 *):not(img):not(.bg):not(.bg *):not(.vol):not(.vol *):not(.background):not(.background *) { ${bg === '#ffffff' ? '' : `background-color: ${bg} !important;`} } body { @@ -223,7 +223,7 @@ const getLayoutStyles = ( svg, img { background-color: transparent !important; } - p:not(.poem):not(.poetry), li, blockquote, dd { + p:not(.poem):not(.poetry):not(.lh):not(:has(> :is(img, video, font, b, h1, h2, h3, h4, h5, table))), li, blockquote, dd { line-height: ${lineSpacing} ${overrideLayout ? '!important' : ''}; word-spacing: ${wordSpacing}px ${overrideLayout ? '!important' : ''}; letter-spacing: ${letterSpacing}px ${overrideLayout ? '!important' : ''}; @@ -243,7 +243,7 @@ const getLayoutStyles = ( ${!vertical ? `margin-top: ${paragraphMargin}em ${overrideLayout ? '!important' : ''};` : ''} ${!vertical ? `margin-bottom: ${paragraphMargin}em ${overrideLayout ? '!important' : ''};` : ''} } - li, p:has(> :is(img, video, font, h1, h2, h3, h4, h5, table)) { + li, p:has(> :is(img, video, font, b, h1, h2, h3, h4, h5, table)) { text-indent: 0 !important; } /* prevent the above from overriding the align attribute */ diff --git a/packages/foliate-js b/packages/foliate-js index d989dd37..6f69a365 160000 --- a/packages/foliate-js +++ b/packages/foliate-js @@ -1 +1 @@ -Subproject commit d989dd372652538468278e844b3e9ad5a8695e67 +Subproject commit 6f69a365b81c749f740b921ca31556adf09c497d