devctrl.resources.icon#

Theme-aware application icon loading.

Loading icons#

Set icon seach paths using ICON_LOAD_PATH.insert(0, <path>) for light mode icons and ICON_LOAD_PATH_DARK.insert(0, <path>) for dark-mode icons.

To load icons in the app, use

icon: QIcon = load_icon(“search”)

The returned QIcon automatically selects the light or dark icon when Qt’s system color scheme changes. Existing widgets do not need to have their icons replaced manually.

Adapting icon colors#

To adapt an icon theme, for example to automatically turn a light scheme into a dark scheme, use devctrl.utility.svg_recolor. When devctrl is installed with pip, this script is installed as devctrl-replace-colors. You can then use it as

devctrl-replace-colors -i resources/icons -o resources/icons-dark –light-to-dark #f00=#b00 …

You can also use it to change the default blue shade of devctrl's icons to something else:

devctrl-replace-colors -i <path-to-devctrl-src>/resources/icons -o resources/icons “#2f88ff=#f00” “#43ccf8=#f80”

would replace the darker blue with red and the lighter blue with orange. You should then put this new path first in the search path, so that the new icons take priority over devctrl defaults.

Adding new icons#

devctrl uses the multi-colored version of the IconPark theme. The entire theme can be downloaded (in the multi-color version) from https://iconpark.oceanengine.com/official. To keep the repo size low, add new icons by adding their name to required-icons.txt and running make icons.

Functions

find_device_icon_path

get_icon_not_found_icon

is_dark_mode

Return whether Qt currently considers the system theme dark.

load_device_icon

load_icon

Load an application icon.

Classes