Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 06-27-2022, 02:03 PM   #1
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,633
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
A possible new feature for Sigil 1.9.11?

Right now, Sigil has the option to make Preview simulates a dark appearence in dark mode. Would it be possible to add a new option when the user has opted for a dark appearence, that the Preview Panel shows colors inverted? (just in PP). For example, instead of showing "red" (rgb(255, 0, 0), it shows rgb(0, 255, 255) (or in hexadecimal, instead of #ff0000, is displayed #00ffff). So, instead of showing the "user_color", it shows (white - user_color = color_displayed). All this, as an option of course, because many users of dark mode very possible won't like this way of displaying colors in PP.
RbnJrg is offline   Reply With Quote
Old 06-27-2022, 02:25 PM   #2
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,341
Karma: 203719646
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
I'm not sure I follow. There is no "user color" for Preview. There is the book's css. The only thing dark appearance in Preview does is attempt to inject (via css) text/background colors. i.e. white text with the current Window color for background. And it only works if the ebook hasn't already explictly set text/backgound colors via css.

I'm just not certain we could offer anything "inverted", since we have no way of knowing what theming (either with style plugins on Linux, or custom css on all platforms) is already in play. The current Window background color and light text is only a compromise. One that I'm not sure we can (or should) offer any alternatives for. It's already very fragile as it is. That's why it's not enabled by default when Sigil is using a dark theme. The custom preview css feature would be better suited for those who wish to customize their dark-mode (or any mode for that matter) Preview colors in my opinion.

Remember that the inherent dark mode you're likely forcing on Sigil (with the environment variable) on Linux is only one of many dark themes that are available to Linux users via custom Qt theming engines and Qt style plugins. We use the background color of the current theme and light text to approximately match everything. And as mentioned, it only works when ebooks don't force their own text/background colors.

Last edited by DiapDealer; 06-27-2022 at 02:42 PM.
DiapDealer is offline   Reply With Quote
Advert
Old 06-27-2022, 02:40 PM   #3
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,633
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by DiapDealer View Post
I'm not sure I follow. There is no "user color" for Preview. There is the book's css. The only thing dark appearance in Preview does is attempt to inject (via css) text/background colors. i.e. white text with the current Window color for background. And it only works if the ebook hasn't already explictly set text/backgound colors via css.

I'm just not certain we could offer anything "inverted", since we have no way of knowing what theming (either with style plugins on Linux, or custom css on all platforms) is already in play. The current Window background color and light text is only a compromise. One that I'm not sure we can (or should) offer any alternatives for. It's already very fragile as it is. That's why it's not enabled by default when Sigil is using a dark theme. The custom preview css feature would be better suited for those who wish to customize their dark-mode (or any mode for that matter) Preview colors in my opinion.
When I mean "user_color", I am saying colors defined in the .css stylesheet. That is PP (in dark mode) shows not .css colors but ITS complementaries.
RbnJrg is offline   Reply With Quote
Old 06-27-2022, 02:48 PM   #4
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,341
Karma: 203719646
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Unless I'm mistaken (and I may be: Kevin can probably answer better), getting Preview to analyze an ebook's css and then attempt to inject complimentary colors would be no small feat. We currently inject our dark colors into Preview blindly whenever the checkbox is selected. That kind of parsing each and every time Preview is refreshed could add considerable processing overhead. I'm not even certain how we would go about determining which colors we would be "inverting". What if there are no defined colors in the stylesheet? What if there are tons?

Last edited by DiapDealer; 06-27-2022 at 02:55 PM.
DiapDealer is offline   Reply With Quote
Old 06-27-2022, 03:55 PM   #5
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 808
Karma: 2416112
Join Date: Jan 2017
Location: Poland
Device: Various
@RbnJrg: Try use this code in custom_preview_style.css file:

Code:
:root {
    background-color: initial!important;
    color: initial!important;
    filter: invert(1);}
Attached Thumbnails
Click image for larger version

Name:	Sample-for-RbnJrg.png
Views:	239
Size:	35.3 KB
ID:	194598  
BeckyEbook is online now   Reply With Quote
Advert
Old 06-27-2022, 04:50 PM   #6
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,633
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by BeckyEbook View Post
@RbnJrg: Try use this code in custom_preview_style.css file:

Code:
:root {
    background-color: initial!important;
    color: initial!important;
    filter: invert(1);}
Becky, your solution is perfect, brillant, for .css colors; it's exactly what I wanted. But there is an issue, the background-color appears as white. By removing "background-color: initial!important;" doesn't fix the problem. And neither has effect to uncheck the option "Make preview simulate..." Any idea about how to solve this drawback? I'm working in Arch Linux with a custom build of Sigil with Qt6.
RbnJrg is offline   Reply With Quote
Old 06-27-2022, 05:06 PM   #7
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,439
Karma: 5703082
Join Date: Nov 2009
Device: many
Did you remember to disable the Dark setting for Preview in Sigil Settings?
KevinH is online now   Reply With Quote
Old 06-27-2022, 05:07 PM   #8
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 808
Karma: 2416112
Join Date: Jan 2017
Location: Poland
Device: Various
Hmmm,

What if you just added background-color: black; to the CSS file? (It works for me)
BeckyEbook is online now   Reply With Quote
Old 06-27-2022, 05:40 PM   #9
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,633
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by BeckyEbook View Post
Hmmm,

What if you just added background-color: black; to the CSS file? (It works for me)
I did the try with dark setting for Preview checked and unchecked without success. And also background-color: black doesn't work here. Maybe is a bug caused by Qt 6.3.1.
RbnJrg is offline   Reply With Quote
Old 06-27-2022, 05:45 PM   #10
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,633
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by BeckyEbook View Post
Hmmm,

What if you just added background-color: black; to the CSS file? (It works for me)
Solved! I only have to change the selector, with "body" instead of ":root" your solution works like a charm!

Code:
body {
    background-color: initial !important;
    color: initial !important;
    filter: invert(1);
}
Many thanks Becky!

EDIT: By the way, maybe Kevin or Diap could add as an option your very smart style "filter: invert(1)" in dark mode, so by checking or unchecking the option, the user would have both alternatives.

Last edited by RbnJrg; 06-27-2022 at 05:50 PM.
RbnJrg is offline   Reply With Quote
Old 06-28-2022, 09:56 AM   #11
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,439
Karma: 5703082
Join Date: Nov 2009
Device: many
Unless I am missing something (and I easily could be) to be useful the epub would have to use many different colours of text before this makes any sense.

Given how much of a pain adding options can be, I do not think adding an option for this makes a lot of sense, given the few people who would use it. Especially considering the custom_preview_style.css approach can do what you want.

What advantage does this provide for a typical epub?

Last edited by KevinH; 06-28-2022 at 10:01 AM.
KevinH is online now   Reply With Quote
Old 06-28-2022, 10:21 AM   #12
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,341
Karma: 203719646
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
What's further... the fact that Linux themes allow many different hues of "dark" background (black, blue, dark grey, brown, etc...), there is still no guarantee that an inverse text color will even be compatible with the Preview background color.

To me... this is exactly why the custom_preview_style.css feature was added in the first place.
DiapDealer is offline   Reply With Quote
Old 06-28-2022, 11:49 AM   #13
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,633
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by KevinH View Post
What advantage does this provide for a typical epub?
Try to use for example in dark mode an style like "border: 2px solid black" and tell me if you can see the border. Or try to use borders for a table, or a table-cell (black borders) and tell me if you can see them. Do you think that in a typical epub nobody will use a table with borders, or nobody will use a border for text? Or do you think that can be very strange to use capital letters inverted? (that is, on a black background, a white letter). In dark mode, you can't see that effect. But I'm going to do the things easier for you: open the epub I attach in dark mode and watch how it looks with the style "filter: invert(1)" enabled and disabled (and with color: initial !important and background-color: initial !important).

With dark mode you can't see colors like darkblue, or navy, etc., etc. but when the filter is appied, the layout based on colors can be appreciated. The ideal would be to have a tool to enabled and disabled the style filter: invert(1) with one click (or to have a shortcut to do that) according to the circunstances.
Attached Files
File Type: epub Dark mode case.epub (2.8 KB, 164 views)

Last edited by RbnJrg; 06-28-2022 at 11:52 AM.
RbnJrg is offline   Reply With Quote
Old 06-28-2022, 11:55 AM   #14
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,633
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by DiapDealer View Post
What's further... the fact that Linux themes allow many different hues of "dark" background (black, blue, dark grey, brown, etc...), there is still no guarantee that an inverse text color will even be compatible with the Preview background color.

To me... this is exactly why the custom_preview_style.css feature was added in the first place.
Sigil not only runs under Linux, there is a Windows and a Mac version And for what you are saying, is useful the option that I'm asking for. Just to enable or to disable the filter invert for PP.
RbnJrg is offline   Reply With Quote
Old 06-28-2022, 12:05 PM   #15
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,341
Karma: 203719646
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
But your suggestion still won't guarantee the inverted colors will be visible. That's what I keep trying to say. You're focused on dark = black. And that's just because you're using the dark mode that ships with Sigil that uses black. Not everyone (and frankly not that many at all) does on Linux. They use a system supplied Qt theme for Sigil. And the background of another dark theme on linux could just as well be maroon, or dark gray.

There will never be a good (let alone failsafe) way to override an ebook's css colors. For darkmode or any other other reason. And much work to attempt to do so (for an editor no less--not even a reader) doesn't make a lot of sense to me.
DiapDealer is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Feature requested for Sigil 1.7 RbnJrg Sigil 23 08-06-2021 08:44 AM
Need Feedback on UserDictionaries feature of Sigil KevinH Sigil 11 08-29-2020 02:19 PM
A few Sigil Feature Requests crankypants Sigil 6 11-03-2015 09:56 AM
Parity feature with Sigil roger64 Editor 8 03-17-2014 11:28 AM
Is auto-relinking a Sigil feature? dlw Sigil 2 06-27-2011 12:43 AM


All times are GMT -4. The time now is 11:38 AM.


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