Fix: move colors_transform to colorsys (#832)

* `colors_transform` is deprecated and superceded by `colorsys`

  ref: https://crates.io/crates/colors-transform
This commit is contained in:
a-kenji 2021-11-02 11:46:06 +01:00 committed by GitHub
parent 7e9dc406bc
commit 070de7a4d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 9 deletions

8
Cargo.lock generated
View file

@ -373,10 +373,10 @@ dependencies = [
] ]
[[package]] [[package]]
name = "colors-transform" name = "colorsys"
version = "0.2.11" version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9226dbc05df4fb986f48d730b001532580883c4c06c5d1c213f4b34c1c157178" checksum = "4dfdf9179d546b55ff3f88c9d93ecfaa3e9760163da5a1080af5243230dbbb70"
[[package]] [[package]]
name = "concurrent-queue" name = "concurrent-queue"
@ -2906,7 +2906,7 @@ dependencies = [
"async-std", "async-std",
"backtrace", "backtrace",
"bincode", "bincode",
"colors-transform", "colorsys",
"crossbeam", "crossbeam",
"directories-next", "directories-next",
"interprocess", "interprocess",

View file

@ -11,7 +11,7 @@ license = "MIT"
[dependencies] [dependencies]
backtrace = "0.3.55" backtrace = "0.3.55"
bincode = "1.3.1" bincode = "1.3.1"
colors-transform = "0.2.5" colorsys = "0.6.5"
crossbeam = "0.8.0" crossbeam = "0.8.0"
directories-next = "2.0" directories-next = "2.0"
interprocess = "1.1.1" interprocess = "1.1.1"

View file

@ -2,7 +2,7 @@
use std::{iter, str::from_utf8}; use std::{iter, str::from_utf8};
use colors_transform::{Color, Rgb}; use colorsys::Rgb;
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
use std::path::Path; use std::path::Path;
use std::{fs, io}; use std::{fs, io};
@ -52,10 +52,9 @@ pub mod colors {
} }
pub fn _hex_to_rgb(hex: &str) -> (u8, u8, u8) { pub fn _hex_to_rgb(hex: &str) -> (u8, u8, u8) {
let rgb = Rgb::from_hex_str(hex) Rgb::from_hex_str(hex)
.expect("The passed argument must be a valid hex color") .expect("The passed argument must be a valid hex color")
.as_tuple(); .into()
(rgb.0 as u8, rgb.1 as u8, rgb.2 as u8)
} }
pub fn default_palette() -> Palette { pub fn default_palette() -> Palette {