Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coloring icons in RGB results in very poor quality #225

Open
JulianOrteil opened this issue Dec 22, 2022 · 5 comments
Open

Coloring icons in RGB results in very poor quality #225

JulianOrteil opened this issue Dec 22, 2022 · 5 comments

Comments

@JulianOrteil
Copy link

Using the following screenshot:
image

Recoloring the icons in grayscale is fine, but RGB results in the above regardless of the size. In the gray on the right of the image, the left set of icons is displayed after being converted to a QPixmap. The button on the right is keeping the icon as a QIcon. This also occurs regardless of the provider (Material Design, FontAwesome, etc).

My environment (Anaconda):

  • Python 3.10
  • Ubuntu 20.04
  • PySide6 6.4.1
@JulianOrteil
Copy link
Author

Update: setting the icon color using HEX seems to work properly...

@dalthviz
Copy link
Member

Hi @JulianOrteil thank you for the feedback! Could it be possible for you to give us some basic code snippet to test this in our side? About your test using HEX, could it be something then Qt related? Also, could you try to use a different binding or version (PyQt6, PySide2 or PyQt5) to see if the error is just for PySide6? Let us know!

@JulianOrteil
Copy link
Author

Apologies for the delay. I'll hopefully get an MRE to you before the end of the week. Completely overloaded right now!

@StSav012
Copy link
Contributor

That's the code I've got from the picture:

# -*- coding: utf-8 -*-
import sys

from qtpy import QtCore, QtGui, QtWidgets

import qtawesome as qta


class AwesomeExample(QtWidgets.QWidget):
    def __init__(self):
        super().__init__()

        icon_name: str = 'mdi6.help-circle'
        icon_size: QtCore.QSize = QtCore.QSize(24, 24)
        icon: QtGui.QIcon = qta.icon(icon_name, color='red')

        button: QtWidgets.QToolButton = QtWidgets.QToolButton(self)
        button.setIcon(icon)
        button.setIconSize(icon_size)

        label: QtWidgets.QLabel = QtWidgets.QLabel(self)
        label.setPixmap(icon.pixmap(icon_size))

        layout: QtWidgets.QHBoxLayout = QtWidgets.QHBoxLayout()
        for w in [button, label]:
            layout.addWidget(w)
        self.setLayout(layout)


def main() -> int:
    app: QtWidgets.QApplication = QtWidgets.QApplication(sys.argv)
    window: AwesomeExample = AwesomeExample()
    window.show()
    return app.exec()


if __name__ == '__main__':
    sys.exit(main())

And it does not reproduce the issue. I have a slightly different system, though:

  • Fedora Linux 6.3.8-100.fc37.x86_64,
  • Python 3.11.4,
  • PySide6 6.5.1.1 or PyQt5 5.15.2,
  • X11 Display Manager.

The last item makes me wonder whether @JulianOrteil used Wayland back then.

@JulianOrteil
Copy link
Author

Thanks for the ping @StSav012. This completely fell off my radar. I was unfortunately reassigned to different projects almost immediately in the second week of January. If I can, I'll see if I can get the current team to provide any details on if they are still encountering this.

From my recollection, I was on Ubuntu 22.04 when I saw this issue. The software was being deployed on a Raspberry Pi, and through my tests, I don't recall if I ever saw this issue there.

@dalthviz dalthviz modified the milestones: v1.3.0, v1.4.0 Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants