Skip to content

Icons and fonts

Pyzed bundles the Lucide icon font (~2000 icons, ISC license). Icons are drawn as text, so they are sharp at any size and take any color:

pz.icon("folder", size=16, color="#74ade8")
ui.button("Open", self.open, icon="folder-open")
ui.list_item("Settings", self.settings, icon="settings")

Without a color, pz.icon takes the color of the surrounding text. Icons inside pyzed.ui components use the theme’s icon and icon_muted tokens, so they follow the theme.

Look up names at lucide.dev/icons or from the terminal:

Terminal window
uv run pyzed icons git
# git-branch, git-commit-horizontal, git-compare, git-fork, git-merge, git-pull-request, ...

pyzed.icons.names() returns the full list and pyzed.icons.glyph("folder") the character, to mix it with text using font="icons".

icons.search finds icons by name and by Lucide’s tags, best first, and icons.category groups them for browsing:

from pyzed import icons
icons.search("person") # ["person-standing", "user", "contact", ...]
icons.category("arrows") # every arrow, chevron, undo...

To let the user choose one, use ui.IconPicker, or ui.icon_picker_dialog in a ui.dialog_layer: a search box, categories and a grid of every icon.

from pyzed import icons
icons.for_file("main.rs") # ("file-code", "#dea584")
icons.for_file("Cargo.toml") # ("file-cog", "#9c4221")
icons.language_for("main.py") # "Python"

ui.Tab.for_file and ui.tree already use them.

Bundled fonts:

Name Font
"sans" (default) IBM Plex Sans
"mono" IBM Plex Mono
"icons" Lucide

"serif" uses the system’s serif font. Choose a font for one text, for a block (every text inside inherits it) or for the whole window:

pz.text("fn main() {}").style(font="mono") # one text
pz.column([...]).style(font="serif", size=15) # every text inside
class MyApp(pz.App):
style = pz.Style(font="mono") # the whole window

Load a .ttf or .otf file before running the app and refer to it by its family name (the name the font declares, not the file name):

pz.load_font("fonts/JetBrainsMono-Regular.ttf")
pz.text("fn main() {}", font="JetBrains Mono")
pz.code_editor("buf", text, font="JetBrains Mono")

load_font also accepts the file’s bytes. Load each weight you use (Regular, Bold…) as its own file.