icon

Module Contents

FluentIconEngine

Fluent icon engine

SvgIconEngine

Svg icon engine

FontIconEngine

Font icon engine

FluentIconBase

Fluent icon base class

FluentFontIconBase

Fluent font icon base class

ColoredFluentIcon

Colored fluent icon

FluentIcon

Fluent icon

Icon

Action

Fluent action

getIconColor([theme, reverse])

get the color of icon based on theme

drawSvgIcon(icon, painter, rect)

draw svg icon

writeSvg(iconPath[, indexes])

write svg with specified attributes

drawIcon(icon, painter, rect[, state])

draw icon

toQIcon(→ PyQt5.QtGui.QIcon)

convet icon to QIcon

class FluentIconEngine(icon, reverse=False)

Bases: PyQt5.QtGui.QIconEngine

Fluent icon engine

icon
isThemeReversed = False
paint(painter, rect, mode, state)
clone() PyQt5.QtGui.QIconEngine
pixmap(size, mode, state)
class SvgIconEngine(svg: str)

Bases: PyQt5.QtGui.QIconEngine

Svg icon engine

svg
paint(painter, rect, mode, state)
clone() PyQt5.QtGui.QIconEngine
pixmap(size, mode, state)
class FontIconEngine(fontFamily: str, char: str, color, isBold)

Bases: PyQt5.QtGui.QIconEngine

Font icon engine

color
char
fontFamily
isBold
paint(painter, rect, mode, state)
clone() PyQt5.QtGui.QIconEngine
pixmap(size, mode, state)
getIconColor(theme=Theme.AUTO, reverse=False)

get the color of icon based on theme

drawSvgIcon(icon, painter, rect)

draw svg icon

Parameters

icon: str | bytes | QByteArray

the path or code of svg icon

painter: QPainter

painter

rect: QRect | QRectF

the rect to render icon

writeSvg(iconPath: str, indexes=None, **attributes)

write svg with specified attributes

Parameters

iconPath: str

svg icon path

indexes: List[int]

the path to be filled

**attributes:

the attributes of path

Returns

svg: str

svg code

drawIcon(icon, painter, rect, state=QIcon.Off, **attributes)

draw icon

Parameters

icon: str | QIcon | FluentIconBaseBase

the icon to be drawn

painter: QPainter

painter

rect: QRect | QRectF

the rect to render icon

**attribute:

the attribute of svg icon

class FluentIconBase

Fluent icon base class

abstract path(theme=Theme.AUTO) str

get the path of icon

Parameters

theme: Theme

the theme of icon * Theme.Light: black icon * Theme.DARK: white icon * Theme.AUTO: icon color depends on config.theme

icon(theme=Theme.AUTO, color: PyQt5.QtGui.QColor = None) PyQt5.QtGui.QIcon

create a fluent icon

Parameters

theme: Theme

the theme of icon * Theme.Light: black icon * Theme.DARK: white icon * Theme.AUTO: icon color depends on qconfig.theme

color: QColor | Qt.GlobalColor | str

icon color, only applicable to svg icon

colored(lightColor: PyQt5.QtGui.QColor, darkColor: PyQt5.QtGui.QColor) ColoredFluentIcon

create a colored fluent icon

Parameters

lightColor: str | QColor | Qt.GlobalColor

icon color in light mode

darkColor: str | QColor | Qt.GlobalColor

icon color in dark mode

qicon(reverse=False) PyQt5.QtGui.QIcon

convert to QIcon, the theme of icon will be updated synchronously with app

Parameters

reverse: bool

whether to reverse the theme of icon

render(painter, rect, theme=Theme.AUTO, indexes=None, **attributes)

draw svg icon

Parameters

painter: QPainter

painter

rect: QRect | QRectF

the rect to render icon

theme: Theme

the theme of icon * Theme.Light: black icon * Theme.DARK: white icon * Theme.AUTO: icon color depends on config.theme

indexes: List[int]

the svg path to be modified

**attributes:

the attributes of modified path

class FluentFontIconBase(char: str)

Bases: FluentIconBase

Fluent font icon base class

fontId = None
fontFamily = None
char
lightColor
darkColor
isBold = False
classmethod fromName(name: str)
bold()
icon(theme=Theme.AUTO, color: PyQt5.QtGui.QColor = None) PyQt5.QtGui.QIcon

create a fluent icon

Parameters

theme: Theme

the theme of icon * Theme.Light: black icon * Theme.DARK: white icon * Theme.AUTO: icon color depends on qconfig.theme

color: QColor | Qt.GlobalColor | str

icon color, only applicable to svg icon

colored(lightColor, darkColor)

create a colored fluent icon

Parameters

lightColor: str | QColor | Qt.GlobalColor

icon color in light mode

darkColor: str | QColor | Qt.GlobalColor

icon color in dark mode

render(painter: PyQt5.QtGui.QPainter, rect, theme=Theme.AUTO, indexes=None, **attributes)

draw svg icon

Parameters

painter: QPainter

painter

rect: QRect | QRectF

the rect to render icon

theme: Theme

the theme of icon * Theme.Light: black icon * Theme.DARK: white icon * Theme.AUTO: icon color depends on config.theme

indexes: List[int]

the svg path to be modified

**attributes:

the attributes of modified path

iconNameMapPath() str
loadFont()

Load icon font

loadIconNames()

Load icon name map

class ColoredFluentIcon(icon: FluentIconBase, lightColor, darkColor)

Bases: FluentIconBase

Colored fluent icon

fluentIcon
lightColor
darkColor
path(theme=Theme.AUTO) str

get the path of icon

Parameters

theme: Theme

the theme of icon * Theme.Light: black icon * Theme.DARK: white icon * Theme.AUTO: icon color depends on config.theme

render(painter, rect, theme=Theme.AUTO, indexes=None, **attributes)

draw svg icon

Parameters

painter: QPainter

painter

rect: QRect | QRectF

the rect to render icon

theme: Theme

the theme of icon * Theme.Light: black icon * Theme.DARK: white icon * Theme.AUTO: icon color depends on config.theme

indexes: List[int]

the svg path to be modified

**attributes:

the attributes of modified path

class FluentIcon

Bases: FluentIconBase, enum.Enum

Fluent icon

UP = 'Up'
ADD = 'Add'
BUS = 'Bus'
CAR = 'Car'
CUT = 'Cut'
IOT = 'IOT'
PIN = 'Pin'
TAG = 'Tag'
VPN = 'VPN'
CAFE = 'Cafe'
CHAT = 'Chat'
COPY = 'Copy'
CODE = 'Code'
DOWN = 'Down'
EDIT = 'Edit'
FLAG = 'Flag'
FONT = 'Font'
GAME = 'Game'
HELP = 'Help'
HIDE = 'Hide'
HOME = 'Home'
INFO = 'Info'
LEAF = 'Leaf'
MAIL = 'Mail'
MENU = 'Menu'
MUTE = 'Mute'
MORE = 'More'
MOVE = 'Move'
PLAY = 'Play'
SAVE = 'Save'
SEND = 'Send'
SYNC = 'Sync'
UNIT = 'Unit'
VIEW = 'View'
WIFI = 'Wifi'
ZOOM = 'Zoom'
ALBUM = 'Album'
BRUSH = 'Brush'
BROOM = 'Broom'
CLOSE = 'Close'
CLOUD = 'Cloud'
EMBED = 'Embed'
GLOBE = 'Globe'
HEART = 'Heart'
LABEL = 'Label'
MEDIA = 'Media'
MOVIE = 'Movie'
MUSIC = 'Music'
ROBOT = 'Robot'
PAUSE = 'Pause'
PASTE = 'Paste'
PHOTO = 'Photo'
PHONE = 'Phone'
PRINT = 'Print'
SHARE = 'Share'
TILES = 'Tiles'
UNPIN = 'Unpin'
VIDEO = 'Video'
TRAIN = 'Train'
ADD_TO = 'AddTo'
ACCEPT = 'Accept'
CAMERA = 'Camera'
CANCEL = 'Cancel'
DELETE = 'Delete'
FOLDER = 'Folder'
FILTER = 'Filter'
MARKET = 'Market'
SCROLL = 'Scroll'
LAYOUT = 'Layout'
GITHUB = 'GitHub'
UPDATE = 'Update'
REMOVE = 'Remove'
RETURN = 'Return'
PEOPLE = 'People'
QRCODE = 'QRCode'
RINGER = 'Ringer'
ROTATE = 'Rotate'
SEARCH = 'Search'
VOLUME = 'Volume'
FRIGID = 'Frigid'
SAVE_AS = 'SaveAs'
ZOOM_IN = 'ZoomIn'
CONNECT = 'Connect'
HISTORY = 'History'
SETTING = 'Setting'
PALETTE = 'Palette'
MESSAGE = 'Message'
FIT_PAGE = 'FitPage'
ZOOM_OUT = 'ZoomOut'
AIRPLANE = 'Airplane'
ASTERISK = 'Asterisk'
CALORIES = 'Calories'
CALENDAR = 'Calendar'
FEEDBACK = 'Feedback'
LIBRARY = 'BookShelf'
MINIMIZE = 'Minimize'
CHECKBOX = 'CheckBox'
DOCUMENT = 'Document'
LANGUAGE = 'Language'
DOWNLOAD = 'Download'
QUESTION = 'Question'
SPEAKERS = 'Speakers'
DATE_TIME = 'DateTime'
FONT_SIZE = 'FontSize'
HOME_FILL = 'HomeFill'
PAGE_LEFT = 'PageLeft'
SAVE_COPY = 'SaveCopy'
SEND_FILL = 'SendFill'
SKIP_BACK = 'SkipBack'
SPEED_OFF = 'SpeedOff'
ALIGNMENT = 'Alignment'
BLUETOOTH = 'Bluetooth'
COMPLETED = 'Completed'
CONSTRACT = 'Constract'
HEADPHONE = 'Headphone'
MEGAPHONE = 'Megaphone'
PROJECTOR = 'Projector'
EDUCATION = 'Education'
LEFT_ARROW = 'LeftArrow'
ERASE_TOOL = 'EraseTool'
PAGE_RIGHT = 'PageRight'
PLAY_SOLID = 'PlaySolid'
BOOK_SHELF = 'BookShelf'
HIGHTLIGHT = 'Highlight'
FOLDER_ADD = 'FolderAdd'
PAUSE_BOLD = 'PauseBold'
PENCIL_INK = 'PencilInk'
PIE_SINGLE = 'PieSingle'
QUICK_NOTE = 'QuickNote'
SPEED_HIGH = 'SpeedHigh'
STOP_WATCH = 'StopWatch'
ZIP_FOLDER = 'ZipFolder'
BASKETBALL = 'Basketball'
BRIGHTNESS = 'Brightness'
DICTIONARY = 'Dictionary'
MICROPHONE = 'Microphone'
ARROW_DOWN = 'ChevronDown'
FULL_SCREEN = 'FullScreen'
MIX_VOLUMES = 'MixVolumes'
REMOVE_FROM = 'RemoveFrom'
RIGHT_ARROW = 'RightArrow'
QUIET_HOURS = 'QuietHours'
FINGERPRINT = 'Fingerprint'
APPLICATION = 'Application'
CERTIFICATE = 'Certificate'
TRANSPARENT = 'Transparent'
IMAGE_EXPORT = 'ImageExport'
SPEED_MEDIUM = 'SpeedMedium'
LIBRARY_FILL = 'LibraryFill'
MUSIC_FOLDER = 'MusicFolder'
POWER_BUTTON = 'PowerButton'
SKIP_FORWARD = 'SkipForward'
CARE_UP_SOLID = 'CareUpSolid'
ACCEPT_MEDIUM = 'AcceptMedium'
CANCEL_MEDIUM = 'CancelMedium'
CHEVRON_RIGHT = 'ChevronRight'
CLIPPING_TOOL = 'ClippingTool'
SEARCH_MIRROR = 'SearchMirror'
SHOPPING_CART = 'ShoppingCart'
FONT_INCREASE = 'FontIncrease'
BACK_TO_WINDOW = 'BackToWindow'
COMMAND_PROMPT = 'CommandPrompt'
CLOUD_DOWNLOAD = 'CloudDownload'
DICTIONARY_ADD = 'DictionaryAdd'
CARE_DOWN_SOLID = 'CareDownSolid'
CARE_LEFT_SOLID = 'CareLeftSolid'
CLEAR_SELECTION = 'ClearSelection'
DEVELOPER_TOOLS = 'DeveloperTools'
BACKGROUND_FILL = 'BackgroundColor'
CARE_RIGHT_SOLID = 'CareRightSolid'
CHEVRON_DOWN_MED = 'ChevronDownMed'
CHEVRON_RIGHT_MED = 'ChevronRightMed'
EMOJI_TAB_SYMBOLS = 'EmojiTabSymbols'
EXPRESSIVE_INPUT_ENTRY = 'ExpressiveInputEntry'
path(theme=Theme.AUTO)

get the path of icon

Parameters

theme: Theme

the theme of icon * Theme.Light: black icon * Theme.DARK: white icon * Theme.AUTO: icon color depends on config.theme

class Icon(fluentIcon: FluentIcon)

Bases: PyQt5.QtGui.QIcon

fluentIcon
toQIcon(icon: PyQt5.QtGui.QIcon | FluentIconBase | str) PyQt5.QtGui.QIcon

convet icon to QIcon

class Action(parent: PyQt5.QtCore.QObject = None, **kwargs)

Bases: PyQt5.QtWidgets.QAction

Fluent action

Constructors

  • Action(parent: QWidget = None, **kwargs)

  • Action(text: str, parent: QWidget = None, **kwargs)

  • Action(icon: QIcon | FluentIconBase, parent: QWidget = None, **kwargs)

fluentIcon = None
icon() PyQt5.QtGui.QIcon
setIcon(icon: FluentIconBase | PyQt5.QtGui.QIcon)