![]() |
#1 |
Connoisseur
![]() Posts: 74
Karma: 10
Join Date: May 2025
Device: iPad
|
How to Set Link Color for Apple Books in Dark Mode?
I have an EPUB containing links which I wanna apply specific colors to. This works well for all e-readers I've tested so far, except for Apple Books which refuses to display any other color for links than the default blue.
The currently applied CSS rules are: Code:
@media (prefers-color-scheme: dark) { a, a:link, a:visited, a:hover, a:focus, a:active { color: #cc0000 !important; -webkit-text-fill-color: #cc0000 !important; } } Does anybody know how to enforce Apple Books to style the links in dedicated colors? I append an example ebook which as said works almost everywhere - but unfortunately only almost... |
![]() |
![]() |
![]() |
#2 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,857
Karma: 8821117
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
What you already tried (color and -webkit-text-fill-color) works fine in most readers, but in iBooks this happens: 1) Apple Books applies its own theme depending on the user’s choice (Light / Sepia / Dark). 2) In dark mode, links are forced to blue for guaranteed contrast. 3) Even with the ibooks-dark-theme-use-custom-text-color class, only regular text can be customized, not links. What you can try is to force fill on an inner span instead of <a>. Wrap the link text in a span and apply the color there. Something like: 1. In your .css stylesheet: Code:
a { color: inherit !important; text-decoration: none !important; } @media (prefers-color-scheme: dark) { a > span { color: #cc0000 !important; -webkit-text-fill-color: #cc0000 !important; text-decoration: underline; } } Code:
<a href="your_ref_here.xhtml"><span>Go to Chapter 2</span></a> Code:
@media (prefers-color-scheme: dark) { a { color: inherit !important; /* neutralize Apple's override */ background: #cc0000 !important; /* desired color */ -webkit-background-clip: text !important; -webkit-text-fill-color: transparent !important; text-decoration: underline; } } |
|
![]() |
![]() |
![]() |
#3 |
Connoisseur
![]() Posts: 74
Karma: 10
Join Date: May 2025
Device: iPad
|
@RbnJrg, thanks for this comprehensive discription. Your first suggestion I've already tried - but didn't work. The second approach is kinda crazy shit I'd never come up by my own^^, thus big points for that - although, you can guess, unfortunately doesn't work as well.
So at this point I assume there is not much to do than to gratulate each and everyone of the e-readers to give their best in making beautiful books from a pain in the ass to just not doable. I mean, there is no big one who refuses to take part in being as annoying as can be. Google Play Books for example just doesn't let you set the text-color for dark mode, insiting to display an ungly gray. And I could go on on all the others as well, it just woudn't help, so I'd spare my nerves and wish them all just roses.... |
![]() |
![]() |
![]() |
#4 |
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80,212
Karma: 148951761
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
My solution is to not use Books for anything.
|
![]() |
![]() |
![]() |
#5 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,857
Karma: 8821117
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
![]() Code:
@media (prefers-color-scheme: dark) { a, a:link, a:visited, a:hover, a:focus, a:active { background: linear-gradient(#cc0000, #cc0000) !important; background: -webkit-linear-gradient(#cc0000, #cc0000) !important; background-clip: text !important; -webkit-background-clip: text !important; color: transparent !important; -webkit-text-fill-color: transparent !important; } } Last edited by RbnJrg; 09-12-2025 at 05:29 PM. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to automatically invert font color in dark mode | davidhcje | Viewer | 3 | 04-26-2024 10:38 AM |
Possible to invert image color in dark mode? | davidhcje | Viewer | 4 | 05-18-2021 08:25 PM |
How do I change the text color to accomodate dark mode? | bookgobrrr | Editor | 8 | 09-26-2020 01:21 PM |
Feature Request: Dark Mode menu color/border | Katsunami | Calibre | 3 | 09-01-2020 05:18 PM |
Scroll bar color is dark mode | JSWolf | Calibre | 1 | 08-03-2020 06:01 AM |