Icon definition generator for lucide icon releases
This project is designed to run in an interval and automatically generate a rust library for every new lucide icons release.
The lucide-icons
cli supports the following arguments
Argument | Description | Default value |
---|---|---|
output |
Directory where the library should be written to | out |
iced-version |
Version of iced to use in the output library |
0.* |
name |
Name of the output library | lucide-icons |
description |
Description of the output library | Rust definitions for lucide-icons |
edition |
Rust edition of the output library | 2024 |
license |
License of the output library | MIT AND ISC |
categories |
Categories of the output library | ["gui"] |
keywords |
Keywords of the output library | ["lucide-icons", "lucide", "icon", "iced", "font"] |
homepage-url |
Url to the output library homepage | none |
repository-url |
Url to the output library repository | none |
readme-path |
Path to the README of the output library | README.md |
autors |
Authors which worked on the output library | [] |
To generate the icon definitions as a library for a specific release tag one can run the following command
lucide-icons [arguments] <tag>
where tag
is the name of a release tag of the lucide-icons repository
The cli is also available in the ghcr.io/whysobad/lucide-icons
docker image.
To generate a new library, the following command can be used:
docker run -v ./out:/app/out ghcr.io/whysobad/lucide-icons lucide-icons [arguments] <tag>
The generated library contains the Icon
rust enum which holds all lucide icons available as variants:
use lucide_icons::Icon;
let icon = Icon::Anvil;
// the variants implement `Display` which returns their icon name
assert_eq!(icon.to_string(), String::from("anvil"));
// using the `unicode` method one can get the unicode character for every variant
println!("unicode = {}", icon.unicode());
Additionally, the library also provides an accessor for the bundled lucide icons font:
use lucide_icons::lucide_font_bytes;
// get font bytes for the bundled font
let font_bytes = lucide_font_bytes();
The library also has the optional iced
feature which also provides lucide icons as pre-defined iced widgets:
use lucide_icons::iced::icon_anvil;
// add the font to iced
let settings = iced::Settings { fonts: vec![font_bytes.into()], ..Default::default() };
fn view() -> iced::Element<'_, Message, Theme, iced::Renderer> {
iced::widget::column![
icon_anvil()
].into()
}
The lucide-icons crate is the official crate generated by this project.
Once a day in a github workflow, new lucide icons releases are reflected as new crate versions and published to crates.io.
Since crates.io does not allow *
dependency wildcards the iced
dependency of the output libraries has to be fixed
to the latest major release. The following table shows which crate versions use which crate versions:
Iced version | Crate version range |
---|---|
0.x.x |
> 0.501.0 |
0.13.x |
<= 0.501.0 |