Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 09-25-2024, 02:32 PM   #1
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,947
Karma: 7225107
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Light/dark mode icons in icon and emblem rules

We've added some support for light and dark themed icons in icon and emblem rules. These changes are in calibre 7.19.

Changes:
  • Addition of an is_dark_mode() template function. Use this in advanced rules to select which icon to return, for example in an 'if' statement.
  • Automatic selection of themed icons based on the icon name and the current mode. The text from the help dialog in the rule definition dialog describes how to use it.
    Quote:
    calibre, version 7.18.100
    You can use different icons in light and dark themes. To do this, add two icons to the icon list. One of the icons must have either the "plain" name, for example "ok.png", or the themed name, for example "ok-for-light-theme.png". The other icon must have a themed name with the same prefix, for example "ok-for-dark-theme.png".

    Example: if the light theme icon is named "ok.png" then the dark theme icon must be named "ok-for-dark-theme.png". If the light theme icon is named "ok-for-light-theme.png" then the dark theme icon must be named either ok.png or "ok-for-dark-theme.png".

    When defining a rule, use either of the icon names. The correct icon for the theme will automatically be used, if it exists.

    You are not required to change existing rules to use theming. Decide the theme where the existing icon should be used then add the other icon with the correct themed name.

    Remember to add both the light and dark theme icons to the list of icons.
Here is an advanced rule that uses the second method, themed icons. It would work in a basic rule as well.
Click image for larger version

Name:	Clipboard01.png
Views:	52
Size:	20.9 KB
ID:	211015

Here are the relevant files in the cc_icons folder.
Click image for larger version

Name:	Clipboard03.png
Views:	43
Size:	11.3 KB
ID:	211016

The result in light mode.
Click image for larger version

Name:	Clipboard05.png
Views:	46
Size:	4.6 KB
ID:	211017

The result in dark mode. Yes, I should add the dark-mode quill icon.
Click image for larger version

Name:	Clipboard06.png
Views:	46
Size:	4.0 KB
ID:	211018

The rules editor showing the help dialog.
Click image for larger version

Name:	Clipboard07.png
Views:	43
Size:	52.7 KB
ID:	211019

Last edited by chaley; 09-27-2024 at 07:08 AM. Reason: Add calibre release containing changes
chaley is offline   Reply With Quote
Old 09-26-2024, 04:52 AM   #2
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 9,315
Karma: 63232809
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
excellent work
ownedbycats is online now   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Light Sensitivity Icon Theme (Dark Mode) Nukjoc Development 2 06-17-2024 06:44 PM
Randomly changing from Dark Mode to Light Mode C8H10N4O2 Calibre 2 07-28-2022 09:36 PM
Any chance of a light/dark mode on a per-book basis? NJMorf Calibre 1 05-06-2022 12:56 AM
Calibre: Light or Dark mode? ownedbycats Calibre 7 03-24-2022 11:10 PM
Icon Rules Tanjamuse Library Management 1 03-02-2015 07:17 AM


All times are GMT -4. The time now is 12:22 PM.


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