Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way to detect if dark theme is active in iBooks from within EPUB?

Does iBooks add something like a CSS class or anything else in order to be able to style some sections of the book differently (in lighter colors) when the night mode is active?

like image 317
reitermarkus Avatar asked Sep 12 '25 11:09

reitermarkus


1 Answers

iBooks adds a __ibooks_internal_theme attribute to the :root (html) element with a value that's changing with the theme selected.

Go ahead with this:

:root[__ibooks_internal_theme*="Sepia"]    
:root[__ibooks_internal_theme*="Night"]

You can find more details on GitHub: theme-detect.css

I will eventually add details on CSS limitations for the three themes.

like image 74
adaptivegarage Avatar answered Sep 14 '25 00:09

adaptivegarage