Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Viewer

Notices

Reply
 
Thread Tools Search this Thread
Old 10-03-2026, 10:59 PM   #1
stasiana
Member
stasiana began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Nov 2023
Device: Kobo Elipsa 2E
Why does Calibre Viewer mangle graphics background colors depending on theme?

I have a sample epub which SVG images containing math. Sometimes they display correctly, and sometimes their background colors are mangled. It depends on the theme I choose in the viewer.

For example:

Click image for larger version

Name:	Screenshot_20261003_195648.png
Views:	16
Size:	29.3 KB
ID:	226410

Click image for larger version

Name:	Screenshot_20261003_195634.png
Views:	20
Size:	28.2 KB
ID:	226409

It seems to depend on what the theme background is. What is this behaviour?

The test file: test.epub
stasiana is offline   Reply With Quote
Old Yesterday, 01:50 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 46,527
Karma: 29634066
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It doesnt mangle anything. A theme sets background colors, depending on what CSS is in your book, it can have background colors that conflict, override or are overridden by the theme background. You can use the override all colors in book setting for consistency, which will override every color defined in the books own CSS
kovidgoyal is offline   Reply With Quote
Old Yesterday, 03:18 PM   #3
stasiana
Member
stasiana began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Nov 2023
Device: Kobo Elipsa 2E
Quote:
Originally Posted by kovidgoyal View Post
It doesnt mangle anything. A theme sets background colors, depending on what CSS is in your book, it can have background colors that conflict, override or are overridden by the theme background. You can use the override all colors in book setting for consistency, which will override every color defined in the books own CSS
No, you're wrong. That is not what is happening.

Create a theme with background #737373. Works.

Change to background #727272. Mangled.

Even the app UI changes in response.
stasiana is offline   Reply With Quote
Old Yesterday, 03:31 PM   #4
Martinoptic
Bibliophist
Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.Martinoptic ought to be getting tired of karma fortunes by now.
 
Martinoptic's Avatar
 
Posts: 9,263
Karma: 8582523
Join Date: Dec 2021
Location: England
Device: none
But doesn't the theme generally change the UI - that's surely what they do?
I don't think I clearly understand the issue....

As Kovid said
Quote:
Originally Posted by kovidgoyal View Post
A theme sets background colors, depending on what CSS is in your book, it can have background colors that conflict, override or are overridden by the theme background.
Martinoptic is offline   Reply With Quote
Old Yesterday, 07:37 PM   #5
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 46,527
Karma: 29634066
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Sorry I can see no mangling 72 and 73 look basically identical to me.
kovidgoyal is offline   Reply With Quote
Old Yesterday, 08:11 PM   #6
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 22,861
Karma: 34252730
Join Date: Mar 2012
Location: Sydney Australia
Device: none
If I select Sepia Dark in Viewer Prefs->Colors->Scheme:

Click image for larger version

Name:	Screenshot 2026-10-05 110416.jpg
Views:	12
Size:	68.2 KB
ID:	226437

I get what the OP gets:

Click image for larger version

Name:	Screenshot 2026-10-05 110056.jpg
Views:	13
Size:	43.2 KB
ID:	226436

BR
BetterRed is offline   Reply With Quote
Old Yesterday, 10:29 PM   #7
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 22,861
Karma: 34252730
Join Date: Mar 2012
Location: Sydney Australia
Device: none
But - Mr Intuit suggested I try on a fresh install, and this is what I got:

Click image for larger version

Name:	Screenshot 2026-10-05 123244.jpg
Views:	8
Size:	39.3 KB
ID:	226438

So, I had a look at my Config, and decided to rename the "viewer_??????.json" files to "viewer_??????.json.save"

When I ran the viewer, I got the same result. The only config file recreated was "viewer-webengine.json", it was 682 bytes - the one I renamed to "*.json.save" is 30,804 bytes.

So, looks like the problem is caused by something in "viewer-webengine.json". Because I don't use Sepia dark I'm not going to investigate further, but I'm attaching a zip with two .json files, one of which exhibits the problem and one of which doesn't, I removed search and file history from the 30,804b file to create the 'bad' one in the zip.

BR
Attached Files
File Type: zip viewer_jasons.zip (3.3 KB, 1 views)

Last edited by BetterRed; Yesterday at 10:33 PM. Reason: forgot the zip file
BetterRed is offline   Reply With Quote
Old Today, 12:23 AM   #8
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 46,527
Karma: 29634066
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I meant there is no mangling in the UI. As for the book itself, the explanation is what I originally posted. The book's CSS conflicts. It tries to be too clever by half and detect dark mode based on colors and apply CSS filters to transform images which conflicts with the CSS rules calibre sets for dark mode themes, again as I said in my original post (though in the other direction) turn off override all book colors and you wont have the issue.

And I guess I can make the override CSS in calibre a bit smarter to outsmart such books by explicitly setting the background color for images and other media elements to transparent so common filters have no effect.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Background color in Calibre 4 viewer jbacelar Calibre 10 10-07-2019 09:21 PM
Calibre PDF Output: Adding Background Rgb colors customization options and Font Color Lodan PDF 7 02-17-2019 09:09 AM
Problem with font & background colors on the Ebook Viewer darthktulu Calibre 3 10-27-2013 11:24 PM
Suggestion on choosing theme colors slayda Marvin 22 09-17-2013 12:27 PM
How to edit skin/theme colors? monkbythesea Calibre 7 08-02-2010 02:18 PM


All times are GMT -4. The time now is 08:51 AM.


MobileRead.com is a privately owned, operated and funded community.