r/programmingprojects

Image 1 — I tried adding a Dark Reader mode to Okular. Here's where I got stuck.
Image 2 — I tried adding a Dark Reader mode to Okular. Here's where I got stuck.
▲ 5 r/programmingprojects+3 crossposts

I tried adding a Dark Reader mode to Okular. Here's where I got stuck.

I was experimenting with adding a Dark Reader–style mode to Okular for PDF documents.

The goal was to darken the page while keeping embedded images untouched. The existing accessibility color modes recolor every pixel, so photos, screenshots, and other raster images also get inverted or recolored, which isn't ideal.

My first implementation worked by post-processing the rendered page. Since Poppler gives you a flattened bitmap through renderToImage(), I used a simple chroma heuristic: recolor near-grayscale pixels (assuming they're text/background) and leave colorful pixels alone. It actually worked reasonably well, but grayscale or muted-color images could still get recolored, which is an unavoidable limitation of that approach.

So I tried to be more hacky. 

Instead of modifying the final rasterized image, I tried working inside Poppler before everything gets flattened. From what I understood, poppler-qt6 only exposes Page::renderToImage(), but Poppler's core library has the OutputDev API (SplashOutputDev, CairoOutputDev, etc.), where the renderer still knows whether it's drawing text, vector graphics, or embedded images. My idea was to hook in there so I could recolor only text/vector content while leaving raster images completely untouched.

Unfortunately, I couldn't get it working the way I wanted. The result was basically just a grayscale/black-and-white rendering instead of the Dark Reader–style effect I was aiming for.

Has anyone here worked with Poppler's OutputDev API or implemented something similar? Is this the right direction, or is there a better approach for separating text/vector content from images during rendering?

The code is here if anyone is curious or wants to point out where I'm going wrong:
https://github.com/JustBipin/okular

Note: I'm not familiar with the C++ ecosystem at all, so I leaned pretty heavily on Zed Editor's free AI to help build the feature. I eventually ran out of free usage though. 😿 Any guidance from people who know Poppler or Okular's rendering pipeline would be greatly appreciated.

u/Consistent_Art1010 — 3 days ago
▲ 15 r/programmingprojects+13 crossposts

I built a free desktop job search tool that searches 12 job boards at once – looking for testers!

Built a Python desktop app that lets you search across 12 job providers simultaneously — no more switching between tabs.

Supported sources:
Adzuna, Reed, Findwork, Jooble, HeadHunter, BA (DE), Arbeitnow, The Muse, RemoteOK, WWR, Remotive & HIM

Features:
• Filter by job title, location and country
• Toggle providers on/off individually
• Saved Results, Auto Run & Analytics tabs
• Dark UI, built with Python + Tkinter

Free to download — would love feedback from anyone who tries it!

https://todorvankov.com/job-search-tool

todorvankov.com
u/behind_the_sun2 — 11 days ago