Skip to content

Commit 6ab5870

Browse files
committed
Fix tinted icon colors based on theme
1 parent 7bfc907 commit 6ab5870

File tree

5 files changed

+22
-10
lines changed

5 files changed

+22
-10
lines changed

changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Marz Workbench Changelog
22

3+
## 0.1.15 (Nov 21th 2024)
4+
5+
- Fix tinted icon colors based on theme
6+
7+
## 0.1.14 (Nov 20th 2024)
8+
9+
- Fix PySide6 issues
10+
311
## 0.1.13 (Nov 20th 2024)
412

513
- Add PySide6 ThreadPool support

freecad/marz/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# | along with Marz Workbench. If not, see <https://www.gnu.org/licenses/>. |
1919
# +---------------------------------------------------------------------------+
2020

21-
__version__ = "0.1.14"
21+
__version__ = "0.1.15"
2222
__author__ = "Frank David Martinez M <mnesarco at gmail.com>"
2323
__copyright__ = "Copyright (c) 2020, Frank David Martinez M."
2424
__license__ = "GPLv3"

freecad/marz/feature/style.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,23 @@
2323
from freecad.marz.extension.paths import iconPath, graphicsPath
2424
from freecad.marz.utils import text
2525

26+
class ThemeColorsHack(ui.QLabel):
27+
def paintEvent(self, e: ui.QPaintEvent):
28+
qp = ui.QPainter()
29+
qp.begin(self)
30+
qp.fillRect(0, 0, 5, 10, qp.pen().color())
31+
qp.end()
32+
2633
# This is a hack to obtain the text color depending on the current stylesheet
2734
# There is no way to get stylesheet info directly in Qt
2835
def get_base_colors() -> Tuple[ui.Color, ui.Color]:
29-
lb = ui.QLabel('L')
30-
lb.setStyleSheet('font-size: 50px; padding: 0px; margin: 0px; border: none;')
36+
lb = ThemeColorsHack()
3137
lb.setGeometry(0,0,10,10)
3238
pixmap = ui.QPixmap(10,10)
3339
lb.render(pixmap)
3440
image = pixmap.toImage()
35-
background = image.pixelColor(0,5)
36-
color = image.pixelColor(9,5)
37-
if color == background:
38-
color = image.pixelColor(4,5)
41+
background = image.pixelColor(9,5)
42+
color = image.pixelColor(1,5)
3943
return ui.Color(color), ui.Color(background)
4044

4145
TEXT_COLOR, BG_COLOR = get_base_colors()

manifest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
;* General identification metadata *
44
;***************************************************************************
55
[general]
6-
version=0.1.14
6+
version=0.1.15
77
name=Marz
88
title=Marz Guitar Design
99
description=Parametric Guitar Design

package.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package format="1">
33
<name>Marz Workbench</name>
44
<description>Parametric Guitar design workbench</description>
5-
<version>0.1.14</version>
5+
<version>0.1.15</version>
66
<maintainer email="twitter: @mnesarco">Frank Martinez</maintainer>
77
<license file="LICENSE">GPL-3.0</license>
88
<url type="repository" branch="master">https://github.com/mnesarco/MarzWorkbench</url>
@@ -13,7 +13,7 @@
1313
<name>Marz Workbench</name>
1414
<classname>MarzWorkbench</classname>
1515
<description>Parametric Guitar design workbench.</description>
16-
<version>0.1.14</version>
16+
<version>0.1.15</version>
1717
<subdirectory>./</subdirectory>
1818
<icon>Resources/icons/Marz.svg</icon>
1919
<freecadmin>0.21.0</freecadmin>

0 commit comments

Comments
 (0)