Skip to content

Commit 206ba6c

Browse files
authored
Merge pull request #22 from alexwlchan/bump-palette
Bump the version of kmeans-colors and palette
2 parents 4ecb6ec + ebcf5fb commit 206ba6c

File tree

4 files changed

+48
-17
lines changed

4 files changed

+48
-17
lines changed

CHANGELOG.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# Changelog
22

3+
## v1.1.8 - 2022-10-24
4+
5+
More internal refactoring to use newer versions of kmeans-colors and palette.
6+
7+
This has no feature changes.
8+
39
## v1.1.7 - 2022-10-24
410

5-
Some internal refactoring to use newer versions of libraries.
11+
Some internal refactoring to use a newer versions of clap.
612

713
This has no feature changes.
814

Cargo.lock

+34-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[package]
22
name = "dominant_colours"
3-
version = "1.1.7"
3+
version = "1.1.8"
44
edition = "2018"
55

66
[dependencies]
77
assert_cmd = "2.0.5"
88
clap = "4.0.18"
99

1010
[dependencies.kmeans_colors]
11-
version = "0.4.0"
11+
version = "0.5.0"
1212
features = ["palette_color"]
1313
default-features = false
1414

@@ -18,6 +18,6 @@ features = ["jpeg", "png", "gif", "tiff"]
1818
default-features = false
1919

2020
[dependencies.palette]
21-
version = "0.5"
21+
version = "0.6"
2222
default-features = false
2323
features = ["std"]

src/main.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
extern crate clap;
55

66
use kmeans_colors::get_kmeans_hamerly;
7-
use palette::{Lab, Pixel, Srgb, Srgba};
7+
use palette::{FromColor, IntoColor, Lab, Pixel, Srgb, Srgba};
88

99
mod cli;
1010
mod get_bytes;
@@ -30,10 +30,10 @@ fn main() {
3030

3131
// This is based on code from the kmeans-colors binary, but with a bunch of
3232
// the options stripped out.
33-
// See https://github.com/okaneco/kmeans-colors/blob/9960c55dbc572e08d564dc341d6fd7e66fa79b5e/src/bin/kmeans_colors/app.rs
33+
// See https://github.com/okaneco/kmeans-colors/blob/0.5.0/src/bin/kmeans_colors/app.rs
3434
let lab: Vec<Lab> = Srgba::from_raw_slice(&img_bytes)
3535
.iter()
36-
.map(|x| x.into_format().into())
36+
.map(|x| x.into_format::<_, f32>().into_color())
3737
.collect();
3838

3939
let max_iterations = 20;
@@ -46,7 +46,7 @@ fn main() {
4646
let rgb = &result
4747
.centroids
4848
.iter()
49-
.map(|x| Srgb::from(*x).into_format())
49+
.map(|x| Srgb::from_color(*x).into_format())
5050
.collect::<Vec<Srgb<u8>>>();
5151

5252
// This uses ANSI escape sequences and Unicode block elements to print

0 commit comments

Comments
 (0)