Skip to content

🌈 Convert values to color simply and securely.

License

Notifications You must be signed in to change notification settings

andrelmlins/coloring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌈 Coloring

Convert values to color simply and securely.

  • Convert in hexadecimal, rgb, hsl, cmyk, hsv and hwb formats.
  • Case sensitive.
  • Always returns the same result for a string (Pure function).

Crates.io β€’ Crates.io β€’ Build Status β€’ API

Installation

Add the dependency in the Cargo.toml file:

[dependencies]
coloring = "0.3"

Basic Use

extern crate coloring::Coloring;

fn main() {
  let coloring = Coloring::new("My String");

  println!("{}", coloring.to_hexadecimal());
  // #259f0c

  println!("{:?}", coloring.to_rgb());
  // [37, 159, 12]

  println!("{:?}", coloring.to_hsl());
  // [110.0, 86.0, 34.0]

  println!("{:?}", coloring.to_cmyk());
  // [77.0, 0.0, 92.0, 38.0]

  println!("{:?}", coloring.to_hsv());
  // [110.0, 86.0, 34.0]

  println!("{:?}", coloring.to_hwb());
  // [110.0, 5.0, 38.0]
}

License

Coloring is open source software licensed as MIT.

About

🌈 Convert values to color simply and securely.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages