cosmic-freedesktop-icons/README.md

50 lines
1.2 KiB
Markdown
Raw Normal View History

2022-05-13 11:16:09 +02:00
# freedesktop-icons
2022-05-17 07:16:01 +02:00
![crates.io-badge](https://img.shields.io/crates/v/freedesktop-icons)
![docrs-badge](https://img.shields.io/docsrs/freedesktop-icons)
2022-05-13 11:16:09 +02:00
This crate provides a [freedesktop icon](https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#implementation_notes) lookup implementation.
2022-05-13 11:28:56 +02:00
It exposes a single `lookup` function to find icons based on their `name`, `theme`, `size` and `scale`.
2022-05-13 11:16:09 +02:00
## Example
**Simple lookup:**
The following snippet get an icon from the default 'hicolor' theme
with the default scale (`1`) and the default size (`24`).
```rust
use freedesktop_icons::lookup;
let icon = lookup("firefox").find();
```
**Complex lookup:**
2022-05-13 11:28:56 +02:00
If you have specific requirements for your lookup you can use the provided builder functions:
2022-05-13 11:16:09 +02:00
```rust
use freedesktop_icons::lookup;
let icon = lookup("firefox")
.with_size(48)
.with_scale(2)
.with_theme("Arc")
.find();
```
**Cache:**
If your application is going to repeat the same icon lookups multiple times
you can use the internal cache to improve performance.
```rust
use freedesktop_icons::lookup;
let icon = lookup("firefox")
.with_size(48)
.with_scale(2)
.with_theme("Arc")
.with_cache()
.find();
```