Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 10-04-2022, 06:27 PM   #1
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 998
Karma: 6417070
Join Date: Sep 2020
Device: Calibre E-book viewer
Dark Color Palette - Scrollbar slider CSS

In trying out the Dark Color Palette, I noticed two elements that have low contrast display, in my setting:

Click image for larger version

Name:	MWSnap0698 2022-10-04, 19_03_43.png
Views:	98
Size:	89.6 KB
ID:	196985

Is there some CSS hack I could apply to them? It seems to me both the search dropdown and the scrollbar slider would be more distinguished if they had a lighter color...

This is what I would like to customise:
https://developer.mozilla.org/en-US/...bkit-scrollbar
::-webkit-scrollbar-thumb — the draggable scrolling handle.
Comfy.n is online now   Reply With Quote
Old 10-04-2022, 06:55 PM   #2
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: 20,575
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
I suspect that's a Qt on Windows issue, Sigil is the same in dark mode. Not sure if its the same on other platforms.

MS Office had the same problem with Dark, which they fixed; so maybe it's a 'generic' issue.

BR
BetterRed is online now   Reply With Quote
Old 10-04-2022, 11:35 PM   #3
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: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It is a Qt limitation.
kovidgoyal is offline   Reply With Quote
Old 10-04-2022, 11:45 PM   #4
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 998
Karma: 6417070
Join Date: Sep 2020
Device: Calibre E-book viewer
Bummer :\
Comfy.n is online now   Reply With Quote
Old 10-06-2022, 03:26 AM   #5
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 998
Karma: 6417070
Join Date: Sep 2020
Device: Calibre E-book viewer
What about this:
https://forum.qt.io/topic/59351/qscr...ine-when-moved
https://stackoverflow.com/questions/...t-doesnt-apply

I recall being able to customise some QT or maybe GTK based program on Windows... though only vaguely.
Comfy.n is online now   Reply With Quote
Old 10-06-2022, 03:41 AM   #6
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 998
Karma: 6417070
Join Date: Sep 2020
Device: Calibre E-book viewer
I just saw there's some environment variable called QT_STYLE_OVERRIDE...

You can also set the style for all Qt applications by setting the QT_STYLE_OVERRIDE environment variable.

Click image for larger version

Name:	MWSnap0705 2022-10-06, 04_39_37.png
Views:	71
Size:	94.0 KB
ID:	197001

In https://doc.qt.io/qt-6/qapplication.html
Comfy.n is online now   Reply With Quote
Old 10-06-2022, 03:54 AM   #7
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: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
stylesheets tend to break things, unless used in a very limited way. you are welcome to play with them if you like, you could probably get something hackish that works for you
kovidgoyal is offline   Reply With Quote
Old 10-06-2022, 04:19 AM   #8
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 998
Karma: 6417070
Join Date: Sep 2020
Device: Calibre E-book viewer
Quote:
Originally Posted by kovidgoyal View Post
stylesheets tend to break things, unless used in a very limited way. you are welcome to play with them if you like, you could probably get something hackish that works for you
thanks, I wonder how to play with them in Windows.. (without having to fiddle with calibre main code or build from source hopefully, as I have little knowledge/resources)

I recall vaguely some GTK editor that was very user-friendly as it worked mostly like a wysiwyg editor... But it seems there's no similar Qt alternative.

BTW, in Goldendict, for instance, there's a file called qt-style.css. I'm able to style most objects colors in it, except that ::-webkit-scrollbar-thumb thing...

Wondering too how that QT_STYLE_OVERRIDE would be useful...
Comfy.n is online now   Reply With Quote
Old 10-06-2022, 04:28 AM   #9
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: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You do need to run calibre from source, but doing so does nto involve any building. https://manual.calibre-ebook.com/develop.html

Look in gui2/__init__.py

where QApplication is constructed and pass it the path to stylesheet with -stylesheet.
kovidgoyal is offline   Reply With Quote
Old 10-06-2022, 06:22 AM   #10
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 998
Karma: 6417070
Join Date: Sep 2020
Device: Calibre E-book viewer
Quote:
Originally Posted by kovidgoyal View Post
You do need to run calibre from source, but doing so does nto involve any building. https://manual.calibre-ebook.com/develop.html

Look in gui2/__init__.py

where QApplication is constructed and pass it the path to stylesheet with -stylesheet.
WHEEEEEEEEEEEEEEEEEE
feels awesome to run Calibre from source!
I'm feeling devilish with my new calibre-dev shortcut, ha.

already can see the new "adjust width" item in context menu:
Click image for larger version

Name:	MWSnap0709 2022-10-06, 07_00_26.png
Views:	85
Size:	16.9 KB
ID:	197002

But still can't barely see that darn scrollbar handle, as I'll have to figure out that pass it the path to stylesheet with -stylesheet bit.
Comfy.n is online now   Reply With Quote
Old 10-06-2022, 09:01 AM   #11
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 998
Karma: 6417070
Join Date: Sep 2020
Device: Calibre E-book viewer
Quote:
Originally Posted by kovidgoyal View Post
Look in gui2/__init__.py

where QApplication is constructed and pass it the path to stylesheet with -stylesheet.
Well.. I see I need to use this:
https://doc.qt.io/qt-6/qapplication....tyleSheet-prop

Now how/where would I insert the path to a stylesheet in gui2/__init__.py?
In trying to guess, I found this in line 1090:

Code:
class Application(QApplication):

    shutdown_signal_received = pyqtSignal()
    palette_changed = pyqtSignal()

    def __init__(self, args=(), force_calibre_style=False, override_program_name=None, headless=False, color_prefs=gprefs, windows_app_uid=None):
then I tried this:

Code:
[...]color_prefs=gprefs, windows_app_uid=None, stylesheet=c:\x.qss):
Program wouldn't load... Then tried running "calibre.exe -stylesheet c:\x.qss", no good either

Also, looking in https://doc.qt.io/qt-6/stylesheet-syntax.html I'm not sure if the file should have .qss or .css extension. First thing I'd like to test is using a wildcard as in:

Code:
* -webkit-scrollbar-thumb {
  background-color: blue;    /* color of the scroll thumb */
  border-radius: 20px;       /* roundness of the scroll thumb */
  border: 3px solid orange;  /* creates padding around scroll thumb */
}
(reference: https://www.digitalocean.com/communi...css-scrollbars
Comfy.n is online now   Reply With Quote
Old 10-06-2022, 10:38 AM   #12
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: 43,860
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Just before the call to QApplication.__init__(self, args) you do

args += ['-stylesheet', 'path/to/stylesheet.qss']
kovidgoyal is offline   Reply With Quote
Old 10-06-2022, 09:50 PM   #13
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 998
Karma: 6417070
Join Date: Sep 2020
Device: Calibre E-book viewer
it seems I'm getting warmer!!

Click image for larger version

Name:	MWSnap0711 2022-10-06, 22_57_34.png
Views:	75
Size:	105.3 KB
ID:	197024


Last edited by Comfy.n; 10-06-2022 at 09:58 PM.
Comfy.n is online now   Reply With Quote
Old 10-07-2022, 01:39 AM   #14
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 998
Karma: 6417070
Join Date: Sep 2020
Device: Calibre E-book viewer
Welp. I managed to make the scrollbar handle more distinctive, but my test.qss does work only when setting Calibre User interface style to System Default, in Look and Feel preferences.

Click image for larger version

Name:	MWSnap0715 2022-10-07, 01_03_59.png
Views:	59
Size:	24.4 KB
ID:	197027

That white on green handle was achieved using this qss styling. (corresponding attached file: test1.qss)

Click image for larger version

Name:	MWSnap0716 2022-10-07, 01_31_18.png
Views:	64
Size:	21.3 KB
ID:	197026

Then, after seeing this thread, I merged the previous scrollbar styling with the custom dark theme mentioned.
That's almost exactly what I needed to achieve, but some elements in this custom dark theme, like padding and border sizes don't fit Calibre UI as perfectly as the built-in dark color palette. (corresponding attached file: test.qss)

Click image for larger version

Name:	MWSnap0714 2022-10-07, 00_57_52.png
Views:	59
Size:	33.1 KB
ID:	197028

If I set Calibre Interface settings in Look and feel to "calibre style", the external qss gets overriden. So I end up in the same situation as before, as seen above. :\

Notes on what I had to to, running Calibre from source:

- location of qss file: one level above the /src directory
- code placement in gui2/__init__.py:

Code:
    def __init__(self, args=(), force_calibre_style=False, override_program_name=None, headless=False, color_prefs=gprefs, windows_app_uid=None):
        if not args:
            args = sys.argv[:1]
        args += ['-stylesheet', 'test.qss']
I also looked in palette.py to see if I could make Calibre not override my qss file when using the built-in dark theme, so that I could get the result seen in the second pic but wasn't able to figure that out.
Attached Files
File Type: zip qss-files.zip (7.0 KB, 47 views)

Last edited by Comfy.n; 10-07-2022 at 01:55 AM.
Comfy.n is online now   Reply With Quote
Old 10-07-2022, 02:13 AM   #15
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 998
Karma: 6417070
Join Date: Sep 2020
Device: Calibre E-book viewer
On another note, there's an undesirable styling of the details scrollbar too, when using that test.qss:

Click image for larger version

Name:	MWSnap0717 2022-10-07, 03_07_36.png
Views:	62
Size:	16.2 KB
ID:	197030

it would be nice to have that one styled independently...
Comfy.n is online now   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Improve Dark Mode Slider Button Contrast? LKraus Calibre 2 04-26-2022 09:26 AM
CSS line height vs Kobo line spacing slider? bongoman Kobo Reader 2 07-12-2020 01:25 PM
CSS text color should be dark blue. Everywhere. nkormanik Calibre 10 05-06-2019 05:29 AM
Glo dark-yellow color on the screen? greens Kobo Reader 8 01-06-2013 09:31 PM
Classic Nook Book Cover Slider Color geneticlone Barnes & Noble NOOK 3 12-31-2009 03:35 PM


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


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