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

feat: Add support for Tabler icons #51

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@
[submodule "icon_resources/material-design-icons"]
path = icon_resources/material-design-icons
url = https://github.com/google/material-design-icons
[submodule "icon_resources/tabler-icons"]
path = icon_resources/tabler-icons
url = https://github.com/tabler/tabler-icons
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ The following features are available. Please see [react-icons site](https://reac
- [hero-icons-solid](https://docs.rs/dioxus-free-icons/latest/dioxus_free_icons/icons/hi_solid_icons/index.html)
- [ionicons](https://docs.rs/dioxus-free-icons/latest/dioxus_free_icons/icons/io_icons/index.html)
- [lucide](https://docs.rs/dioxus-free-icons/latest/dioxus_free_icons/icons/ld_icons/index.html)
- [tabler-icons-filled](https://docs.rs/dioxus-free-icons/latest/dioxus_free_icons/icons/tb_filled_icons/index.html)
- [tabler-icons-outline](https://docs.rs/dioxus-free-icons/latest/dioxus_free_icons/icons/tb_outline_icons/index.html)
- [material-design-icons-action](https://docs.rs/dioxus-free-icons/latest/dioxus_free_icons/icons/md_action_icons/index.html)
- [material-design-icons-alert](https://docs.rs/dioxus-free-icons/latest/dioxus_free_icons/icons/md_alert_icons/index.html)
- [material-design-icons-av](https://docs.rs/dioxus-free-icons/latest/dioxus_free_icons/icons/md_av_icons/index.html)
Expand Down Expand Up @@ -85,6 +87,7 @@ Icon Library|License|Version
[Lucide](https://lucide.dev)|[ISC License](https://github.com/lucide-icons/lucide/blob/main/LICENSE)| [0.265.0](https://github.com/lucide-icons/lucide/tree/v0.265.0)
[Material Design icons](https://developers.google.com/fonts/docs/material_icons)|[Apache License 2.0](https://github.com/google/material-design-icons/blob/master/LICENSE)| [4.0.0](https://github.com/google/material-design-icons/tree/4.0.0)
[Octicons](https://primer.style/octicons/)|[MIT License](https://github.com/primer/octicons/blob/main/LICENSE)| [17.3.0](https://github.com/primer/octicons/tree/v17.3.0)
[Tabler Icons](https://tabler-icons.io/)|[MIT License](https://github.com/tabler/tabler-icons/blob/main/LICENSE)| [3.10.0](https://github.com/tabler/tabler-icons/tree/v3.10.0)

## Contribution

Expand Down
1 change: 1 addition & 0 deletions icon_resources/tabler-icons
Submodule tabler-icons added at c5f045
3 changes: 3 additions & 0 deletions packages/codegen/src/create_icon_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ fn extract_svg_colors(icon_prefix: &str) -> (&str, &str, &str) {
match icon_prefix {
"Fi" => ("\"none\"", "user_color", "\"2\""),
"Ld" => ("\"none\"", "user_color", "\"2\""),
"Tb" => ("\"none\"", "user_color", "\"0\""),
"Io" => ("user_color", "user_color", "\"0\""),
_ => ("user_color", "\"none\"", "\"0\""),
}
Expand All @@ -163,6 +164,7 @@ fn extract_stroke_linecap(icon_prefix: &str) -> &str {
match icon_prefix {
"Ld" => "round",
"Fi" => "round",
"Tb" => "round",
_ => "butt",
}
}
Expand All @@ -171,6 +173,7 @@ fn extract_stroke_linejoin(icon_prefix: &str) -> &str {
match icon_prefix {
"Ld" => "round",
"Fi" => "round",
"Tb" => "round",
_ => "miter",
}
}
Expand Down
8 changes: 8 additions & 0 deletions packages/codegen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ fn main() {
create_icon_file::create_icon_file(&svg_path, &output_path, "Hi");
}

// create tabler icons
const TB_SVG_BASE_PATH: &str = "../../icon_resources/tabler-icons/icons";
for icon_type in vec!["filled", "outline"].into_iter() {
let svg_path = format!("{}/{}", TB_SVG_BASE_PATH, icon_type);
let output_path = format!("{}/tb_{}_icons.rs", OUTPUT_BASE_PATH, icon_type);
create_icon_file::create_icon_file(&svg_path, &output_path, "Tb");
}

// create ionicons
const IO_SVG_BASE_PATH: &str = "../../icon_resources/ionicons/src/svg";
let output_path = format!("{}/io_icons.rs", OUTPUT_BASE_PATH);
Expand Down
2 changes: 2 additions & 0 deletions packages/lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ hero-icons-outline = []
hero-icons-solid = []
ionicons = []
lucide = []
tabler-icons-filled = []
tabler-icons-outline = []
material-design-icons-action = []
material-design-icons-alert = []
material-design-icons-av = []
Expand Down
4 changes: 4 additions & 0 deletions packages/lib/src/icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ pub mod hi_solid_icons;
pub mod io_icons;
#[cfg(feature = "lucide")]
pub mod ld_icons;
#[cfg(feature = "tabler-icons-filled")]
pub mod tb_filled_icons;
#[cfg(feature = "tabler-icons-outline")]
pub mod tb_outline_icons;
#[cfg(feature = "material-design-icons-action")]
pub mod md_action_icons;
#[cfg(feature = "material-design-icons-alert")]
Expand Down
Loading
Loading