From e7b2d8435e6de598b3cf021ca19c76277611602f Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Thu, 23 Oct 2025 00:52:30 +0800 Subject: [PATCH] feat(eink): set underline text decoration for links in E-Ink mode, closes #2293 (#2299) --- apps/readest-app/src/components/settings/ControlPanel.tsx | 2 +- apps/readest-app/src/utils/style.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/readest-app/src/components/settings/ControlPanel.tsx b/apps/readest-app/src/components/settings/ControlPanel.tsx index eb8487fb..35d0655c 100644 --- a/apps/readest-app/src/components/settings/ControlPanel.tsx +++ b/apps/readest-app/src/components/settings/ControlPanel.tsx @@ -119,7 +119,7 @@ const ControlPanel: React.FC = ({ bookKey, onRegisterRes }, [animated]); useEffect(() => { - saveViewSettings(envConfig, bookKey, 'isEink', isEink, false, false); + saveViewSettings(envConfig, bookKey, 'isEink', isEink); if (isEink) { getView(bookKey)?.renderer.setAttribute('eink', ''); } else { diff --git a/apps/readest-app/src/utils/style.ts b/apps/readest-app/src/utils/style.ts index 31e2131c..13ef585a 100644 --- a/apps/readest-app/src/utils/style.ts +++ b/apps/readest-app/src/utils/style.ts @@ -112,6 +112,7 @@ const getColorStyles = ( invertImgColorInDark: boolean, themeCode: ThemeCode, backgroundTextureId: string, + isEink: boolean, ) => { const { bg, fg, primary, isDarkMode } = themeCode; const colorStyles = ` @@ -142,7 +143,7 @@ const getColorStyles = ( } a:any-link { ${overrideColor ? `color: ${primary};` : isDarkMode ? `color: lightblue;` : ''} - text-decoration: none; + text-decoration: ${isEink ? 'underline' : 'none'}; } body.pbg { ${isDarkMode ? `background-color: ${bg} !important;` : ''} @@ -526,6 +527,7 @@ export const getStyles = (viewSettings: ViewSettings, themeCode?: ThemeCode) => viewSettings.invertImgColorInDark!, themeCode, viewSettings.backgroundTextureId, + viewSettings.isEink, ); const translationStyles = getTranslationStyles(viewSettings.showTranslateSource!); const userStylesheet = viewSettings.userStylesheet!;