![]() |
#1 |
Connoisseur
![]() Posts: 73
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,853
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; } } |
|
![]() |
![]() |
Advert | |
|
![]() |
|
![]() |
||||
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 |