#color-palette #image #graphics #algorithm #grabs #dominant #representative

color-thief

Grabs the dominant color or a representative color palette from an image

4 releases

Uses old Rust 2015

0.2.2 Jun 4, 2022
0.2.1 Jul 17, 2020
0.2.0 Jun 25, 2020
0.1.0 Aug 1, 2017

#206 in Images

Download history 1947/week @ 2023-11-23 1934/week @ 2023-11-30 1797/week @ 2023-12-07 1845/week @ 2023-12-14 1488/week @ 2023-12-21 1454/week @ 2023-12-28 2092/week @ 2024-01-04 2117/week @ 2024-01-11 1785/week @ 2024-01-18 2003/week @ 2024-01-25 2098/week @ 2024-02-01 2277/week @ 2024-02-08 2014/week @ 2024-02-15 1998/week @ 2024-02-22 2016/week @ 2024-02-29 1771/week @ 2024-03-07

8,110 downloads per month
Used in 12 crates (7 directly)

MIT license

525KB
415 lines

color-thief-rs

color-thief-rs is a color-thief algorithm reimplementation in Rust.

The implementation itself is a heavily modified Swift version of the same algorithm.

Differences

  • There is no getColor method, since it's just a shorthand for getPalette.
  • Output colors are a bit different from JS version. See tests for details.

Performance

About 150x faster that JS version.

test q1  ... bench:   1,429,800 ns/iter (+/- 21,987)
test q10 ... bench:     854,297 ns/iter (+/- 25,468)

Usage

Dependency: Rust >= 1.13

Add this to your Cargo.toml:

[dependencies]
color-thief = "0.2"

License

color-thief-rs is licensed under the MIT.


lib.rs:

color-thief-rs is a color-thief algorithm reimplementation in Rust.

The implementation itself is a heavily modified Swift version of the same algorithm.

Dependencies