#color #graphics

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

#406 in Images

Download history 2658/week @ 2024-12-08 2576/week @ 2024-12-15 2164/week @ 2024-12-22 2106/week @ 2024-12-29 3096/week @ 2025-01-05 2884/week @ 2025-01-12 2790/week @ 2025-01-19 2470/week @ 2025-01-26 2943/week @ 2025-02-02 2716/week @ 2025-02-09 3290/week @ 2025-02-16 2492/week @ 2025-02-23 2244/week @ 2025-03-02 2821/week @ 2025-03-09 1550/week @ 2025-03-16 2899/week @ 2025-03-23

9,766 downloads per month
Used in 15 crates (9 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