![]() |
#1 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 977
Karma: 2209358
Join Date: Nov 2011
Location: London, UK
Device: Kobo Aura, Kobo Aura ONE, PocketBook InkPad Color 3
|
Dark mode and inline SVG
I'm using some inline SVG in my own personal books to include some vector art diagrams in the chapters. This works OK so far in the kepub engine.
What happens to SVG artwork when you run the reader in dark mode? The SVG hardcodes colours, so will I end up with black artwork on a black background? ![]() Dark mode's a feature of some popular OSes. AIUI in web browsers there's some sort of mechanism in the CSS to detect dark mode and set colours appropriately. Does Kobo's dark mode support that, or is its dark mode more simplistic? I don't think my Aura ONE has the new fangled dark mode support, otherwise I'd test... |
![]() |
![]() |
![]() |
#2 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,941
Karma: 70583139
Join Date: Feb 2009
Device: Kobo Clara 2E
|
Quote:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,251
Karma: 16539642
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
|
Never mind.
Last edited by jackie_w; 01-16-2023 at 01:28 PM. Reason: posted in error |
![]() |
![]() |
![]() |
#4 |
Can't actually read
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 81
Karma: 335656
Join Date: Sep 2019
Device: Kobo Forma, Kobo Sage, Kindle PW2
|
I was under the impression that dark mode literally just inverted the screen.
|
![]() |
![]() |
![]() |
#5 |
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 14,010
Karma: 105092227
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
Some methods do, such as some patches. Better designed dark modes only invert text. On modern systems it's invented to save battery on OLED screens. It's better to simply turn down the rear light on LCD or front light on eInk as the fonts are optimised for black text on a white background. On old mono CRTS they used black background and bright text to save tube life, power and allow better focus.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Can't actually read
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 81
Karma: 335656
Join Date: Sep 2019
Device: Kobo Forma, Kobo Sage, Kindle PW2
|
Quote:
|
|
![]() |
![]() |
![]() |
#7 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 977
Karma: 2209358
Join Date: Nov 2011
Location: London, UK
Device: Kobo Aura, Kobo Aura ONE, PocketBook InkPad Color 3
|
|
![]() |
![]() |
![]() |
#8 | |
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 14,010
Karma: 105092227
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
Quote:
Just tested on Sage with 4.35.x FW and "Arabel and Mortimer Stories" (books 1 to 6 of originals) converted from azw3 to epub2. The page turn flash is also more objectionable in Dark mode. It's best kept to save power on OLED phones and tablets. Turning down the front light works better at night, or no front light at all and suitable small angle-poise lamp just to illuminate the ereader, with a suitable bulb in it (I use the yellow stick filament LED types, very like halogen/daylight with no obvious blue. The yellow coating on the sticks is actually a phosphor). Last edited by Quoth; 01-17-2023 at 06:22 AM. |
|
![]() |
![]() |
![]() |
#9 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,149
Karma: 168983734
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
I use NickelMenu to handle either with the following (change main to whatever other places you want to see this option): Code:
# menu_item : main : Dark Mode : nickel_setting : toggle : dark_mode menu_item :main : Invert & Reboot : nickel_setting :toggle: invert chain_success : power : reboot # |
|
![]() |
![]() |
![]() |
#10 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,591
Karma: 11722446
Join Date: Aug 2010
Location: NE Oregon
Device: Kobo Sage, Pocketbook Era, Kobo Forma, Kindle Oasis 2
|
Quote:
For background info, the SVG was made by myself in Inkscape, saved as plain SVG and is a black line-art image on transparent background. On Kobo Sage, running stock firmware 4.35.204 (which I believe is the current version), in dark mode, I get black artwork on black background. It disappears, in other words, just as you suspected it might. For fun, I kepubified the book, and checked in kepub format, same thing. Black on black. On a Kindle Oasis 2, using epub via Send-To-Kindle which delivers KF8 format, same SVG image inverts to white on black. Hope that helps. |
|
![]() |
![]() |
![]() |
#11 |
Still reading
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 14,010
Karma: 105092227
Join Date: Jun 2017
Location: Ireland
Device: All 4 Kinds: epub eink, Kindle, android eink, NxtPaper
|
Don't use transparency. It doesn't even make sense. Like files for paper print, use white (which is regarded as transparent on print), then the images work properly in Dark Mode.
Amazon doesn't allow transparency. |
![]() |
![]() |
![]() |
#12 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 21
Karma: 147742
Join Date: Nov 2017
Location: Vancouver, BC, Canada
Device: Kobo Touch B/C, Kobo Glo HD, Kobo Clara HD, Kobo Libra 2
|
SVG filters and CSS style for dark mode
I doubt e-readers have support for SVG filters, but the following added to your SVG file works pretty well in most browsers for general dark-mode support. Just add it right after the opening svg element.
Code:
<filter id="darkmode"> <!-- Same as CSS 'filter: invert(1)' but in linear RGB --> <feComponentTransfer> <feFuncR type="table" tableValues="1 0"/> <feFuncG type="table" tableValues="1 0"/> <feFuncB type="table" tableValues="1 0"/> </feComponentTransfer> <!-- Same as CSS 'filter: hue-rotate(180deg)' --> <feColorMatrix type="hueRotate" values="180"/> <!-- Gamma function: C' = amplitude * pow(C, exponent) + offset --> <feComponentTransfer> <feFuncR type="gamma" exponent="2.2"/> <feFuncG type="gamma" exponent="2.2"/> <feFuncB type="gamma" exponent="2.2"/> </feComponentTransfer> </filter> <style> @media (prefers-color-scheme: dark) { svg {filter: url('#darkmode');} } </style> Last edited by jgneff; 01-19-2023 at 02:48 PM. |
![]() |
![]() |
![]() |
#13 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 977
Karma: 2209358
Join Date: Nov 2011
Location: London, UK
Device: Kobo Aura, Kobo Aura ONE, PocketBook InkPad Color 3
|
Quote:
My next problem is trying to figure out how Kobo handles fonts in the SVG. It seems to replace everything I'm trying with one of the serif fonts. Have you figured out what they're doing with fonts, or is the answer just to convert all text to curves? |
|
![]() |
![]() |
![]() |
#14 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,591
Karma: 11722446
Join Date: Aug 2010
Location: NE Oregon
Device: Kobo Sage, Pocketbook Era, Kobo Forma, Kindle Oasis 2
|
Quote:
![]() I agree though, were I publishing, transparency would be a very bad idea. Most use cases would render black on black in my experience. |
|
![]() |
![]() |
![]() |
#15 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,591
Karma: 11722446
Join Date: Aug 2010
Location: NE Oregon
Device: Kobo Sage, Pocketbook Era, Kobo Forma, Kindle Oasis 2
|
Can't help you there, my image is just a little vector graphic, no fonts involved. I do remember way back when, experimenting with SVG title pages, and I think I found that they worked best for me if I converted everything to a path. But that was a while back.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Randomly changing from Dark Mode to Light Mode | C8H10N4O2 | Calibre | 2 | 07-28-2022 09:36 PM |
Bug: Dark Mode (Windows) Book Details Pop-Up Cover Background Not Changing to Dark | cgrapski | Calibre | 7 | 05-03-2021 11:45 PM |
Calibre 4.10 night mode/dark mode | likeaghost | Calibre | 11 | 05-03-2020 05:43 PM |
SVG images, external file versus inline | j.p.s | ePub | 4 | 07-18-2014 11:30 AM |
Inline SVG questions (whitespace & other practices) | politicorific | Workshop | 6 | 04-12-2009 05:32 PM |