diff --git a/main.lua b/main.lua index 6802ae7..a212977 100644 --- a/main.lua +++ b/main.lua @@ -1290,7 +1290,14 @@ function Bookhoard:applyServerAnnotations(annotations) entry.drawer = "lighten" entry.text = srv_text if srv_notes ~= "" then entry.note = srv_notes end - if server_entry.color and server_entry.color ~= "" then entry.color = server_entry.color end + -- KOReader renders highlight colors from a fixed name set + -- (Blitbuffer.HIGHLIGHT_COLORS); anything else (e.g. a web + -- hex value slipping through) draws nothing useful, so only + -- keep plain names and let the device default apply. + local srv_color = server_entry.color or "" + if srv_color ~= "" and not srv_color:find("^#") then + entry.color = srv_color + end else if srv_text ~= "" then entry.note = srv_text end -- bookmark label end @@ -1367,6 +1374,11 @@ function Bookhoard:applyServerAnnotations(annotations) if self.ui.saveSettings then self.ui:saveSettings() end + -- ReaderView paints annotations from the model on each repaint; + -- request one so applied highlights appear immediately. + if self.ui.dialog then + UIManager:setDirty(self.ui.dialog, "ui") + end logger.dbg("Bookhoard: annotations updated from server") end end