14. PDF: Invent a better dark mode color algorithm for PDF pages 和 15. PDF: Invent a better dark mode color algorithm for PDF pages **and** exclude images and graphs - HollowMan6/EAF-OSPP-Summer-2020 GitHub Wiki

相关issue: #14#15

相关PR: #308#350#356#365

启用暗模式时,将整个pdf反转后,可通过反转图像显示位置来实现此功能。

效果:

现在,page_annotate_color将遵循emacs主题前景色

如果eaf-pdf-dark-modefollow,则pdf背景将为emacs主题背景色。

例:

app/pdf-viewer/buffer.py#L331

 if self.emacs_var_dict["eaf-pdf-dark-mode"] == "follow": 

image

因为page.drawRect目前只支持pdf文件,我增加了限制,避免打开epub的时候执行这段语句

另外,增加计算排除图像时的重叠部分:

有了这个补丁,现在我的简历可以在黑暗模式下使用PDF-Viewer正确显示

如果图片有重叠,将通过反转重叠部分来进一步优化#308#350 中PDF查看器中的暗模式图像排除算法。

之前 当前

复杂测试案例:

3层重叠:2.pdf

image

4层重叠:3.pdf

image

4.pdf

image