From a9e33ca50a33650f4e8e821d7c732304ccbcb2d1 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Mon, 6 Apr 2026 00:05:05 +0800 Subject: [PATCH] fix(style): let background texture take precedence over overridden background color (#3761) When a background texture is active, skip applying the overridden bg/fg/border colors on block elements so the texture stays visible instead of being painted over. --- apps/readest-app/src/utils/style.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/readest-app/src/utils/style.ts b/apps/readest-app/src/utils/style.ts index 33fbf732..0e697d6e 100644 --- a/apps/readest-app/src/utils/style.ts +++ b/apps/readest-app/src/utils/style.ts @@ -128,6 +128,7 @@ const getColorStyles = ( isEink: boolean, ) => { const { bg, fg, primary, isDarkMode } = themeCode; + const hasBackgroundTexture = !!backgroundTextureId && backgroundTextureId !== 'none'; const colorStyles = ` html { --bg-texture-id: ${backgroundTextureId}; @@ -153,9 +154,9 @@ const getColorStyles = ( } section, aside, blockquote, article, nav, header, footer, main, figure, div, p, font, h1, h2, h3, h4, h5, h6, li, span { - ${overrideColor ? `background-color: ${bg} !important;` : ''} - ${overrideColor ? `color: ${fg} !important;` : ''} - ${overrideColor ? `border-color: ${fg} !important;` : ''} + ${overrideColor && !hasBackgroundTexture ? `background-color: ${bg} !important;` : ''} + ${overrideColor && !hasBackgroundTexture ? `color: ${fg} !important;` : ''} + ${overrideColor && !hasBackgroundTexture ? `border-color: ${fg} !important;` : ''} } pre, span { /* inline code blocks */ ${overrideColor ? `background-color: ${bg} !important;` : ''}