ePub and Apple Books Grey and Black mode background-color doesn't work

275 views Asked by At

This affects Apple Books ePub rendering. I am able to render the ePub in dark mode in other readers using either prefers-color-scheme or a fallback dark class (or, in the case of Calibre, setting body.calibre-viewer-dark-colors {} where needed.

For the most part, @media (prefers-color-scheme: dark) is working for Apple Books. However, I appear to be unable to set background-color and have it work in Grey and Night. Sepia shows just fine.

The two items I need a background-color on are pre and forcing a white background onto svg images.

I've used:

pre {
    background-color: #212427;
}

img[src ^= "data:image/svg"] {
    background-color: white;
    padding: 10px;

  }

within the media (prefers-color-scheme: dark) but it doesn't seem to matter for Apple Books specifically (other readers relying on this are working). I've also tried setting !important but no dice. The backgrounds work fine in light mode and Sepia.

0

There are 0 answers