A Python library that enables Material Symbols / Material Icons by Google to be used in Qt using PySide.
Install using pip:
pip install qt-material-iconsfrom PySide6 import QtGui
from qt_material_icons import MaterialIcon
# Create a QIcon object
icon = MaterialIcon('search')
# Set a color
color = QtGui.QColor('red')
icon.set_color(color)
# Set a color for a state, for example when a button is checked
icon.set_color(color, state=QtGui.QIcon.State.On)
# Set a different icon for a state, for example when a button is checked
toggle_icon = MaterialIcon('toggle_off')
toggle_icon_on = MaterialIcon('toggle_on')
toggle_icon.set_icon(toggle_icon_on, state=QtGui.QIcon.State.On)Refer to Google Material Symbols & Icons for browsing icons.
Since the qt-material-icons package is quite large with all the resource files, a cli is provided to extract
specific icons so they can be shipped alongside the package.
Install as a dev dependency:
# pyproject.toml
[project.optional-dependencies]
dev = ["qt-material-icons"]Use the cli to extract icons:
qtmaterialicons -o mypackage --styles outlined rounded --sizes 20 24 --names home computer search favoriteThen import in your repo:
from mypackage.qt_material_icons import MaterialIconTo contribute please refer to the Contributing Guide.
MIT License. Copyright 2024 - Beat Reichenbach. See the License file for details.
The Material Symbols / Material Icons are licensed under Apache License Version 2.0.