Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 11-03-2025, 10:36 AM   #1
tentakel
Member
tentakel began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Mar 2019
Device: Kobo Clara HD
Here is a css fix for Articles in darkmode.

Hello all!

I noticed that instapaper articles don't render nicely in especially in dark mode.

Some headlines are rendered black on black, thus disappear and links lack contrast in my opinion.

This script walks through the subfolders of articles and injects a line of css that fixes the issues.

Code:
#!/bin/sh
BASE="/mnt/onboard/.kobo/articles"
STYLE='<style>a, p a { color: inherit !important; font-style: italic; text-decoration: none; border-bottom: 0.5px solid currentColor; padding-bottom: 0.05em; line-height: 1.1; } h1, h2, h3, h4 { color: inherit !important; }</style>'

find "$BASE" -mindepth 2 -maxdepth 2 -type f -name "index.html" | while IFS= read -r file; do
  if grep -q '<style>.*a, p a' "$file"; then
    echo "Skipping (already styled): $file"
  else
    echo "Injecting inline style into: $file"
    tmp="$(mktemp "${file%.html}.XXXX" 2>/dev/null || echo "${file}.tmp")"
    printf '%s\n' "$STYLE" > "$tmp" && cat "$file" >> "$tmp" && mv -f "$tmp" "$file"
  fi
done
I chained it with fix pocket images, which still works for instapaper :

Code:
menu_item:library:Fix Pocket Images:cmd_spawn:quiet:/bin/sh /mnt/onboard/.kobo/articles/inject-style.sh
  chain_success:cmd_spawn:quiet:/bin/sh /mnt/onboard/.adds/pocket/fix.sh
  chain_success:dbg_toast:Done
Question:
Which renderer is kobo using for articles? Obviously a one time patch would be more elegant; The patch for Kepub that should override a link style did not work for me in this case.

Best
tentakel is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to enable nightmode (darkmode) nightmodeguy Introduce Yourself 1 04-20-2023 10:45 AM
Epub rendering or CSS fix? Skydog Kobo Reader 8 03-12-2021 12:46 PM
rss articles web articles - not showing pocket? they used to be able too wakkaday Kobo Reader 4 03-05-2016 05:35 AM
Fix for Kindle 3 problem with Sections and Articles nickredding Development 22 08-19-2011 07:58 PM
(another) FIX: New York Times Missing Articles bcollier Recipes 11 02-11-2011 04:16 PM


All times are GMT -4. The time now is 01:16 AM.


MobileRead.com is a privately owned, operated and funded community.