Skip to content

Commit

Permalink
Fix tinted icon colors based on theme
Browse files Browse the repository at this point in the history
  • Loading branch information
mnesarco committed Nov 21, 2024
1 parent 7bfc907 commit 6ab5870
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
8 changes: 8 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Marz Workbench Changelog

## 0.1.15 (Nov 21th 2024)

- Fix tinted icon colors based on theme

## 0.1.14 (Nov 20th 2024)

- Fix PySide6 issues

## 0.1.13 (Nov 20th 2024)

- Add PySide6 ThreadPool support
Expand Down
2 changes: 1 addition & 1 deletion freecad/marz/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# | along with Marz Workbench. If not, see <https://www.gnu.org/licenses/>. |
# +---------------------------------------------------------------------------+

__version__ = "0.1.14"
__version__ = "0.1.15"
__author__ = "Frank David Martinez M <mnesarco at gmail.com>"
__copyright__ = "Copyright (c) 2020, Frank David Martinez M."
__license__ = "GPLv3"
Expand Down
16 changes: 10 additions & 6 deletions freecad/marz/feature/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,23 @@
from freecad.marz.extension.paths import iconPath, graphicsPath
from freecad.marz.utils import text

class ThemeColorsHack(ui.QLabel):
def paintEvent(self, e: ui.QPaintEvent):
qp = ui.QPainter()
qp.begin(self)
qp.fillRect(0, 0, 5, 10, qp.pen().color())
qp.end()

# This is a hack to obtain the text color depending on the current stylesheet
# There is no way to get stylesheet info directly in Qt
def get_base_colors() -> Tuple[ui.Color, ui.Color]:
lb = ui.QLabel('L')
lb.setStyleSheet('font-size: 50px; padding: 0px; margin: 0px; border: none;')
lb = ThemeColorsHack()
lb.setGeometry(0,0,10,10)
pixmap = ui.QPixmap(10,10)
lb.render(pixmap)
image = pixmap.toImage()
background = image.pixelColor(0,5)
color = image.pixelColor(9,5)
if color == background:
color = image.pixelColor(4,5)
background = image.pixelColor(9,5)
color = image.pixelColor(1,5)
return ui.Color(color), ui.Color(background)

TEXT_COLOR, BG_COLOR = get_base_colors()
Expand Down
2 changes: 1 addition & 1 deletion manifest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;* General identification metadata *
;***************************************************************************
[general]
version=0.1.14
version=0.1.15
name=Marz
title=Marz Guitar Design
description=Parametric Guitar Design
Expand Down
4 changes: 2 additions & 2 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package format="1">
<name>Marz Workbench</name>
<description>Parametric Guitar design workbench</description>
<version>0.1.14</version>
<version>0.1.15</version>
<maintainer email="twitter: @mnesarco">Frank Martinez</maintainer>
<license file="LICENSE">GPL-3.0</license>
<url type="repository" branch="master">https://github.com/mnesarco/MarzWorkbench</url>
Expand All @@ -13,7 +13,7 @@
<name>Marz Workbench</name>
<classname>MarzWorkbench</classname>
<description>Parametric Guitar design workbench.</description>
<version>0.1.14</version>
<version>0.1.15</version>
<subdirectory>./</subdirectory>
<icon>Resources/icons/Marz.svg</icon>
<freecadmin>0.21.0</freecadmin>
Expand Down

0 comments on commit 6ab5870

Please sign in to comment.