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
scripter.utils.setNeedDarkIcon
setNeedDarkIcon(color)
Definition
utils.py:13
scripter.utils.getThemedIcon
QIcon getThemedIcon(filepath)
Definition
utils.py:18
plugins
python
scripter
utils.py
Generated at
2025-11-04 02:30:02+01:00
from
Krita
branch
master
, commit
c9dde2e79561a8aea4a7e8d9ac99c98a7bac9e52