#graphics #color

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

#118 in Images

Download history 1020/week @ 2023-02-01 1189/week @ 2023-02-08 1259/week @ 2023-02-15 1399/week @ 2023-02-22 1423/week @ 2023-03-01 1550/week @ 2023-03-08 1213/week @ 2023-03-15 1299/week @ 2023-03-22 1135/week @ 2023-03-29 1274/week @ 2023-04-05 2043/week @ 2023-04-12 1884/week @ 2023-04-19 1753/week @ 2023-04-26 1445/week @ 2023-05-03 1356/week @ 2023-05-10 1514/week @ 2023-05-17

6,479 downloads per month
Used in 11 crates (6 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