Krita Source Code Documentation
Loading...
Searching...
No Matches
scripter.utils Namespace Reference

Functions

QIcon getThemedIcon (filepath)
 
 setNeedDarkIcon (color)
 

Variables

bool needDarkIcon = False
 

Detailed Description

SPDX-FileCopyrightText: 2022 Ivan Santa Maria <ghevan@gmail.com>

SPDX-License-Identifier: GPL-2.0-or-later

Function Documentation

◆ getThemedIcon()

QIcon scripter.utils.getThemedIcon ( filepath)

Definition at line 18 of file utils.py.

18def 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)

◆ setNeedDarkIcon()

scripter.utils.setNeedDarkIcon ( color)

Definition at line 13 of file utils.py.

13def setNeedDarkIcon(color):
14 global needDarkIcon
15 needDarkIcon = True if color.value() > 100 else False
16 return
17

Variable Documentation

◆ needDarkIcon

bool scripter.utils.needDarkIcon = False

Definition at line 11 of file utils.py.