Krita Source Code Documentation
Loading...
Searching...
No Matches
utils.py
Go to the documentation of this file.
1
"""
2
SPDX-FileCopyrightText: 2022 Ivan Santa Maria <ghevan@gmail.com>
3
4
SPDX-License-Identifier: GPL-2.0-or-later
5
"""
6
try
:
7
from
PyQt6.QtGui
import
QIcon, QPixmap, QColor, QPainter
8
except
:
9
from
PyQt5.QtGui
import
QIcon, QPixmap, QColor, QPainter
10
11
needDarkIcon =
False
12
13
def
setNeedDarkIcon
(color):
14
global
needDarkIcon
15
needDarkIcon =
True
if
color.value() > 100
else
False
16
return
17
18
def
getThemedIcon
(filepath) -> QIcon:
19
global
needDarkIcon
20
pixmap = QPixmap(filepath)
21
painter = QPainter(pixmap)
22
painter.setCompositionMode(QPainter.CompositionMode.CompositionMode_SourceIn)
23
24
if
needDarkIcon:
25
painter.fillRect(pixmap.rect(),QColor(32,32,32))
26
else
:
27
painter.fillRect(pixmap.rect(),QColor(255,255,255))
28
29
painter.end()
30
return
QIcon(pixmap)
QtGui
QtGui
krita.utils.setNeedDarkIcon
setNeedDarkIcon(color)
Definition
utils.py:13
krita.utils.getThemedIcon
QIcon getThemedIcon(filepath)
Definition
utils.py:18
plugins
extensions
pykrita
plugin
krita
utils.py
Generated at
2026-01-15 02:30:07+01:00
from
Krita
branch
master
, commit
38b517ca06286bb65279453cbf9a2b4fbd1153d1