Skip to main content

Bump the version of kmeans-colors and palette

ID
ebcf5fb
date
2022-10-24 19:34:35+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
4ecb6ec
message
Bump the version of kmeans-colors and palette
changed files
4 files, 48 additions, 17 deletions

Changed files

CHANGELOG.md (1190) → CHANGELOG.md (1320)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6342d92..afc7633 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,8 +1,14 @@
 # Changelog
 
+## v1.1.8 - 2022-10-24
+
+More internal refactoring to use newer versions of kmeans-colors and palette.
+
+This has no feature changes.
+
 ## v1.1.7 - 2022-10-24
 
-Some internal refactoring to use newer versions of libraries.
+Some internal refactoring to use a newer versions of clap.
 
 This has no feature changes.
 

Cargo.lock (13462) → Cargo.lock (14107)

diff --git a/Cargo.lock b/Cargo.lock
index c03fa2c..420ad2d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -10,9 +10,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
 
 [[package]]
 name = "approx"
-version = "0.3.2"
+version = "0.5.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f0e60b75072ecd4168020818c0107f2857bb6c4e64252d8d3983f6263b40a5c3"
+checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"
 dependencies = [
  "num-traits",
 ]
@@ -134,7 +134,7 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
 
 [[package]]
 name = "dominant_colours"
-version = "1.1.7"
+version = "1.1.8"
 dependencies = [
  "assert_cmd",
  "clap",
@@ -150,6 +150,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797"
 
 [[package]]
+name = "find-crate"
+version = "0.6.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "59a98bbaacea1c0eb6a0876280051b892eb73594fd90cf3b20e9c817029c57d2"
+dependencies = [
+ "toml",
+]
+
+[[package]]
 name = "flate2"
 version = "1.0.24"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -223,9 +232,9 @@ checksum = "9478aa10f73e7528198d75109c8be5cd7d15fb530238040148d5f9a22d4c5b3b"
 
 [[package]]
 name = "kmeans_colors"
-version = "0.4.0"
+version = "0.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "45b02102b24e8f7163d7f794f2a250e3b5da067994695521310338da0db6ae2c"
+checksum = "1d9f1da1000eb32cea537203e5ea121eb06e66c5e5f3420a1e9f11a57676f55b"
 dependencies = [
  "palette",
  "rand",
@@ -297,9 +306,9 @@ checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff"
 
 [[package]]
 name = "palette"
-version = "0.5.0"
+version = "0.6.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a05c0334468e62a4dfbda34b29110aa7d70d58c7fdb2c9857b5874dd9827cc59"
+checksum = "8f9cd68f7112581033f157e56c77ac4a5538ec5836a2e39284e65bd7d7275e49"
 dependencies = [
  "approx",
  "num-traits",
@@ -308,10 +317,11 @@ dependencies = [
 
 [[package]]
 name = "palette_derive"
-version = "0.5.0"
+version = "0.6.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0b4b5f600e60dd3a147fb57b4547033d382d1979eb087af310e91cb45a63b1f4"
+checksum = "05eedf46a8e7c27f74af0c9cfcdb004ceca158cb1b918c6f68f8d7a549b3e427"
 dependencies = [
+ "find-crate",
  "proc-macro2",
  "quote",
  "syn",
@@ -417,6 +427,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
 
 [[package]]
+name = "serde"
+version = "1.0.147"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
+
+[[package]]
 name = "strsim"
 version = "0.10.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -460,6 +476,15 @@ dependencies = [
 ]
 
 [[package]]
+name = "toml"
+version = "0.5.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
+dependencies = [
+ "serde",
+]
+
+[[package]]
 name = "unicode-ident"
 version = "1.0.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"

Cargo.toml (416) → Cargo.toml (416)

diff --git a/Cargo.toml b/Cargo.toml
index 703b834..c9abd15 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "dominant_colours"
-version = "1.1.7"
+version = "1.1.8"
 edition = "2018"
 
 [dependencies]
@@ -8,7 +8,7 @@ assert_cmd = "2.0.5"
 clap = "4.0.18"
 
 [dependencies.kmeans_colors]
-version = "0.4.0"
+version = "0.5.0"
 features = ["palette_color"]
 default-features = false
 
@@ -18,6 +18,6 @@ features = ["jpeg", "png", "gif", "tiff"]
 default-features = false
 
 [dependencies.palette]
-version = "0.5"
+version = "0.6"
 default-features = false
 features = ["std"]

src/main.rs (8386) → src/main.rs (8395)

diff --git a/src/main.rs b/src/main.rs
index a0dc256..867c999 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -4,7 +4,7 @@
 extern crate clap;
 
 use kmeans_colors::get_kmeans_hamerly;
-use palette::{Lab, Pixel, Srgb, Srgba};
+use palette::{FromColor, IntoColor, Lab, Pixel, Srgb, Srgba};
 
 mod cli;
 mod get_bytes;
@@ -30,10 +30,10 @@ fn main() {
 
     // This is based on code from the kmeans-colors binary, but with a bunch of
     // the options stripped out.
-    // See https://github.com/okaneco/kmeans-colors/blob/9960c55dbc572e08d564dc341d6fd7e66fa79b5e/src/bin/kmeans_colors/app.rs
+    // See https://github.com/okaneco/kmeans-colors/blob/0.5.0/src/bin/kmeans_colors/app.rs
     let lab: Vec<Lab> = Srgba::from_raw_slice(&img_bytes)
         .iter()
-        .map(|x| x.into_format().into())
+        .map(|x| x.into_format::<_, f32>().into_color())
         .collect();
 
     let max_iterations = 20;
@@ -46,7 +46,7 @@ fn main() {
     let rgb = &result
         .centroids
         .iter()
-        .map(|x| Srgb::from(*x).into_format())
+        .map(|x| Srgb::from_color(*x).into_format())
         .collect::<Vec<Srgb<u8>>>();
 
     // This uses ANSI escape sequences and Unicode block elements to print