From 15d278472533537de0f0ddc492a0719fdd0740ee Mon Sep 17 00:00:00 2001 From: Mohammed Efaz Date: Sat, 14 Feb 2026 18:32:52 +0600 Subject: [PATCH] fix: highlight in dark mode eink (#3299) * fix: highlight in dark mode eink * refactor: deduplicate * fix: bw eink highlights to use the fg colour so saved highlights are visible * fix: avoid grayscale color in E-ink mode for better legibility --------- Co-authored-by: Huang Xin --- apps/readest-app/src/utils/style.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/apps/readest-app/src/utils/style.ts b/apps/readest-app/src/utils/style.ts index 7d3588ed..6e3042ad 100644 --- a/apps/readest-app/src/utils/style.ts +++ b/apps/readest-app/src/utils/style.ts @@ -107,6 +107,19 @@ const getFontStyles = ( return fontStyles; }; +const getEinkSelectionStyles = () => { + return ` + ::selection { + color: var(--theme-bg-color); + background: var(--theme-fg-color); + } + ::-moz-selection { + color: var(--theme-bg-color); + background: var(--theme-fg-color); + } + `; +}; + const getColorStyles = ( overrideColor: boolean, invertImgColorInDark: boolean, @@ -127,6 +140,7 @@ const getColorStyles = ( html, body { color: ${fg}; } + ${isEink ? getEinkSelectionStyles() : ''} html[has-background], body[has-background] { --background-set: var(--theme-bg-color); } @@ -884,6 +898,7 @@ export const applyFixedlayoutStyles = ( themeCode = getThemeCode(); } const { bg, fg, primary, isDarkMode } = themeCode; + const isEink = viewSettings.isEink; const overrideColor = viewSettings.overrideColor!; const invertImgColorInDark = viewSettings.invertImgColorInDark!; const darkMixBlendMode = bg === '#000000' ? 'luminosity' : 'overlay'; @@ -905,6 +920,7 @@ export const applyFixedlayoutStyles = ( position: relative; background-color: var(--theme-bg-color); } + ${isEink ? getEinkSelectionStyles() : ''} #canvas { display: inline-block; width: fit-content;