#color-palette #image #graphics #color #algorithm #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

#211 in Images

Download history 2597/week @ 2024-09-23 2277/week @ 2024-09-30 1986/week @ 2024-10-07 3047/week @ 2024-10-14 2933/week @ 2024-10-21 3405/week @ 2024-10-28 2354/week @ 2024-11-04 2856/week @ 2024-11-11 2514/week @ 2024-11-18 2813/week @ 2024-11-25 2817/week @ 2024-12-02 2611/week @ 2024-12-09 2548/week @ 2024-12-16 2168/week @ 2024-12-23 2191/week @ 2024-12-30 2784/week @ 2025-01-06

9,933 downloads per month
Used in 14 crates (8 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