From 58a5c1625c4c4cfae59bc81ac330fb2b0dcc1035 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Tue, 30 Dec 2025 10:24:37 +0100 Subject: [PATCH] fix(css): only override background color of hr when it has background image (#2808) --- apps/readest-app/src/utils/style.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/readest-app/src/utils/style.ts b/apps/readest-app/src/utils/style.ts index 4e4ee1f2..f50d03b7 100644 --- a/apps/readest-app/src/utils/style.ts +++ b/apps/readest-app/src/utils/style.ts @@ -155,7 +155,7 @@ const getColorStyles = ( ${!isDarkMode && overrideColor ? 'mix-blend-mode: multiply;' : ''} } /* horizontal rule #1649 */ - *:has(> hr[class]):not(body) { + *:has(> hr.background-img):not(body) { background-color: ${bg}; } hr { @@ -759,6 +759,12 @@ export const applyImageStyle = (document: Document) => { img.classList.add('has-text-siblings'); } }); + document.querySelectorAll('hr').forEach((hr) => { + const computedStyle = window.getComputedStyle(hr); + if (computedStyle.backgroundImage && computedStyle.backgroundImage !== 'none') { + hr.classList.add('background-img'); + } + }); }; export const applyTableStyle = (document: Document) => {