From 01156923deb05eac69e1399de24993312bc1b2b5 Mon Sep 17 00:00:00 2001 From: hius07 <62179190+hius07@users.noreply.github.com> Date: Sat, 7 Feb 2026 18:15:44 +0200 Subject: [PATCH] readerhighlight: invert dialog colors in night mode (#14923) --- frontend/apps/reader/modules/readerhighlight.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/apps/reader/modules/readerhighlight.lua b/frontend/apps/reader/modules/readerhighlight.lua index 030c56316..60a4e1a16 100644 --- a/frontend/apps/reader/modules/readerhighlight.lua +++ b/frontend/apps/reader/modules/readerhighlight.lua @@ -50,8 +50,16 @@ function ReaderHighlight:getHighlightColorString(color_name) end function ReaderHighlight:getHighlightColor(color_name) - return Blitbuffer.colorFromName(color_name) --- @todo fix in the night mode; issue #14170, #14667 - or Blitbuffer.gray(G_reader_settings:readSetting("highlight_lighten_factor") or 0.2) -- 'gray' or unknown color name + local color = Blitbuffer.colorFromName(color_name) + if color then + if Screen.night_mode then + local r, g, b = Blitbuffer.HIGHLIGHT_COLORS[color_name]:match("#(..)(..)(..)") + return Blitbuffer.colorFromString(string.format("#%02x%02x%02x", + 255 - tonumber(r, 16), 255 - tonumber(g, 16), 255 - tonumber(b, 16))) + end + return color + end + return Blitbuffer.gray(G_reader_settings:readSetting("highlight_lighten_factor") or 0.2) end local function inside_box(pos, box)