diff --git a/Color spaces.md b/Color spaces.md
deleted file mode 100644
index cfeca19..0000000
--- a/Color spaces.md
+++ /dev/null
@@ -1,118 +0,0 @@
-# Color spaces
-
-Color spaces are reproducible representations of color. Most color spaces have three dimensions that describe properties of the color (such as color hue, saturation, luminance), or their composition of primary colors, using a certain [color model](https://en.wikipedia.org/wiki/Color_model).
-
-
-## RGB (sRGB)
-
-[sRGB](https://en.wikipedia.org/wiki/SRGB) (often simply called _RGB_) is a color space of the three primary colors **red**, **green** and **blue**. It uses additive color mixing, which is how colored light works. The sRGB color space is therefore used by computer screens, for example.
-
-Colors in the sRGB color space are represented as three values between 0 and 255. 0 means, the primary color is not present, whereas 255 means that the primary color is at full intensity.
-
-### Examples
-
-| | |
-| ----------------------- |--------------------- |
-| `rgb(0, 0, 0)` | ![color](docs/colors/black.png)
-| `rgb(255, 0, 0)` | ![color](docs/colors/red.png)
-| `rgb(0, 255, 0)` | ![color](docs/colors/green.png)
-| `rgb(0, 0, 255)` | ![color](docs/colors/blue.png)
-| `rgb(255, 255, 0)` | ![color](docs/colors/yellow.png)
-| `rgb(0, 255, 255)` | ![color](docs/colors/cyan.png)
-| `rgb(255, 0, 255)` | ![color](docs/colors/magenta.png)
-| `rgb(255, 255, 255)` | ![color](docs/colors/white.png)
-
-## CMY
-
-[CMY](https://en.wikipedia.org/wiki/CMY_color_model) is the counterpart of RGB: It consists of the primary colors **cyan**, **magenta** and **yellow**, and uses subtractive color mixing, so it behaves like color pigments or dyes.
-
-CMY colors are represented as three values between 0 and 1, or 100%.
-
-### Examples
-
-| | |
-| ---------------|--------------------- |
-| `cmy(0, 0, 0)` | ![color](docs/colors/white.png)
-| `cmy(1, 0, 0)` | ![color](docs/colors/cyan.png)
-| `cmy(0, 1, 0)` | ![color](docs/colors/magenta.png)
-| `cmy(0, 0, 1)` | ![color](docs/colors/yellow.png)
-| `cmy(0, 1, 1)` | ![color](docs/colors/red.png)
-| `cmy(1, 0, 1)` | ![color](docs/colors/green.png)
-| `cmy(1, 1, 0)` | ![color](docs/colors/blue.png)
-| `cmy(1, 1, 1)` | ![color](docs/colors/black.png)
-
-## CMYK
-
-CMYK is a variation of CMY that adds a fourth component, the **key**. This is used primarily by color printers: The CMY color components correspond to the color cartridges, whereas the _key_ corresponds to the black cartridge.
-
-### Examples
-
-| | |
-| ------------------|--------------------- |
-| `cmy(0, 0, 0, 0)` | ![color](docs/colors/white.png)
-| `cmy(1, 0, 0, 0)` | ![color](docs/colors/cyan.png)
-| `cmy(0, 1, 0, 0)` | ![color](docs/colors/magenta.png)
-| `cmy(0, 0, 1, 0)` | ![color](docs/colors/yellow.png)
-| `cmy(0, 1, 1, 0)` | ![color](docs/colors/red.png)
-| `cmy(1, 0, 1, 0)` | ![color](docs/colors/green.png)
-| `cmy(1, 1, 0, 0)` | ![color](docs/colors/blue.png)
-| `cmy(0, 0, 0, 1)` | ![color](docs/colors/black.png)
-
-## HSL
-
-[HSL](https://en.wikipedia.org/wiki/HSL_and_HSV) is a color space designed to be intuitive to understand. It consists of **hue**, **saturation** and **lightness**.
-
-The hue is a value on a radial slice, represented in degrees (0 to 360), where 0 corresponds to red, 120 corresponds to green and 240 to blue. It is equivalent to the hue in the HSV color space.
-
-Saturation and lightness are values between 0 and 1 (or 100%). When the lightness is 0, the color is full black. When it is 1, it is full white. The most vibrant colors are at a lightness of 0.5, or 50%.
-
-### Examples
-
-| | |
-| ------------------|--------------------- |
-| hsl( ?, ?, 0)
| ![color](docs/colors/black.png)
-| hsl( ?, ?, 1)
| ![color](docs/colors/white.png)
-| hsl( 0, 1, .5)
| ![color](docs/colors/red.png)
-| `hsl( 60, 1, .5)` | ![color](docs/colors/yellow.png)
-| `hsl(120, 1, .5)` | ![color](docs/colors/green.png)
-| `hsl(180, 1, .5)` | ![color](docs/colors/cyan.png)
-| `hsl(240, 1, .5)` | ![color](docs/colors/blue.png)
-| `hsl(300, 1, .5)` | ![color](docs/colors/magenta.png)
-
-## HSV
-
-[HSV](https://en.wikipedia.org/wiki/HSL_and_HSV) is also a color space designed to be intuitive to understand. It consists of **hue**, **saturation** and **value**. The hue is the same as in the HSL model. Hue and saturation together describe the [chromaticity](https://en.wikipedia.org/wiki/Chromaticity).
-
-Saturation and value are again values between 0 and 1. When the value is 0, the color is full black. When the value is 1, the color depends on the hue and saturation.
-
-| | |
-| -----------------|--------------------- |
-| hsv( ?, ?, 0)
| ![color](docs/colors/black.png)
-| hsv( ?, 0, 1)
| ![color](docs/colors/white.png)
-| hsv( 0, 1, 1)
| ![color](docs/colors/red.png)
-| `hsv( 60, 1, 1)` | ![color](docs/colors/yellow.png)
-| `hsv(120, 1, 1)` | ![color](docs/colors/green.png)
-| `hsv(180, 1, 1)` | ![color](docs/colors/cyan.png)
-| `hsv(240, 1, 1)` | ![color](docs/colors/blue.png)
-| `hsv(300, 1, 1)` | ![color](docs/colors/magenta.png)
-
-
-## LAB (CIELAB)
-
-[CIELAB](https://en.wikipedia.org/wiki/CIELAB_color_space) is a color space consisting of three values: __L\*__ for the lightness from black (0) to white (100), __a\*__ from green (−) to red (+), and __b\*__ from blue (−) to yellow (+). It was designed so that the same amount of numerical change in these values corresponds to roughly the same amount of visually perceived change. __a\*__ and __b\*__ together describe the [chromaticity](https://en.wikipedia.org/wiki/Chromaticity) (hue and colorfulness).
-
-CIELAB is designed to approximate human vision. It's __L\*__ component closely matches human perception of lightness.
-
-## LCH (CIELCh)
-
-[CIELCh](https://en.wikipedia.org/wiki/CIELAB_color_space#Cylindrical_representation:_CIELCh_or_CIEHLC)
-
-## LUV (CIELUV)
-
-[CIELUV](https://en.wikipedia.org/wiki/CIELUV)
-
-## Hunter Lab
-
-## XYZ
-
-## YXY
diff --git a/README.md b/README.md
index c7fc146..7aa2ab0 100644
--- a/README.md
+++ b/README.md
@@ -61,19 +61,21 @@ If `colo` is used outside of a terminal, it outputs the color as text. The forma
### Supported color spaces
-| Name | Description | Range of values |
-|-------------|------------------------------------|-----------------|
-| `rgb` | red, green, blue | 0 to 255 |
-| `cmy` | cyan, magenta, yellow | 0 to 1 |
-| `cmyk` | cyan, magenta, yellow, key | 0 to 1 |
-| `hsv` | hue, saturation, value | hue: 0 to 360, saturation: 0 to 1, value: 0 to 1 |
-| `hsl` | hue, saturation, light | hue: 0 to 360, saturation: 0 to 1, light: 0 to 1 |
-| `lch` | luminance, chroma, hue | luminance: 0 to 100, chroma: 0 to 100, hue: 0 to 360 |
-| `luv` | CIELUV color (luminance, u, v) | luminance: 0 to 100, u: -134 to 220, v: -140 to 122 |
-| `lab` | CIELAB color (lightness, a, b) | lightness: 0 to 100, a: ??, b: ?? |
-| `hunterlab` | Hunter Lab color (lightness, a, b) | lightness: 0 to 100, a: ??, b: ?? |
-| `xyz` | CIE 1931 XYZ color | ?? |
-| `yxy` | CIE YXY color | ?? |
+Read in more detail about these color spaces [here](https://aloso.github.io/colo/color_spaces#srgb-rgb).
+
+| Name | Description | Range of values |
+|-------------|---------------------------------|---------------------|
+| `rgb` | red, green, blue | 0 to 255 |
+| `cmy` | cyan, magenta, yellow | 0 to 1 |
+| `cmyk` | cyan, magenta, yellow, key | 0 to 1 |
+| `hsl` | hue, saturation, light | hue: 0 to 360, saturation: 0 to 1, light: 0 to 1 |
+| `hsv` | hue, saturation, value | hue: 0 to 360, saturation: 0 to 1, value: 0 to 1 |
+| `lab` | CIELAB (lightness, a, b) | lightness: 0 to 100 |
+| `lch` | CIELCh (luminance, chroma, hue) | luminance: 0 to 100, chroma: 0 to 100, hue: 0 to 360 |
+| `luv` | CIELUV (luminance, u, v) | luminance: 0 to 100, u: -134 to 220, v: -140 to 122 |
+| `hunterlab` | Hunter Lab (lightness, a, b) | lightness: 0 to 100 |
+| `xyz` | CIE XYZ (x, lightness, z) | lightness: 0 to 100 |
+| `yxy` | CIE Yxy (lightness, x, y) | lightness: 0 to 100 |
### Specifying hexadecimal colors
@@ -129,8 +131,6 @@ Also, to pass continuous integration, the code must
* compile on the latest stable Rust version
* all tests must succeed
-Note: I'm currently refactoring the code base, so this is a bad time for large pull requests. I should be finished with this in a week at the latest.
-
You can also look in the issue tracker for issues with the label [help wanted](https://github.com/Aloso/colo/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22).
That's it! If you have any questions, feel free to create an issue.
diff --git a/docs/colors/black.png b/docs/colors/black.png
deleted file mode 100644
index 2d99bd8..0000000
Binary files a/docs/colors/black.png and /dev/null differ
diff --git a/docs/colors/blue.png b/docs/colors/blue.png
deleted file mode 100644
index ba45325..0000000
Binary files a/docs/colors/blue.png and /dev/null differ
diff --git a/docs/colors/cyan.png b/docs/colors/cyan.png
deleted file mode 100644
index 655a23f..0000000
Binary files a/docs/colors/cyan.png and /dev/null differ
diff --git a/docs/colors/green.png b/docs/colors/green.png
deleted file mode 100644
index f3499af..0000000
Binary files a/docs/colors/green.png and /dev/null differ
diff --git a/docs/colors/magenta.png b/docs/colors/magenta.png
deleted file mode 100644
index 03902bc..0000000
Binary files a/docs/colors/magenta.png and /dev/null differ
diff --git a/docs/colors/red.png b/docs/colors/red.png
deleted file mode 100644
index 643c58e..0000000
Binary files a/docs/colors/red.png and /dev/null differ
diff --git a/docs/colors/white.png b/docs/colors/white.png
deleted file mode 100644
index 9eaa470..0000000
Binary files a/docs/colors/white.png and /dev/null differ
diff --git a/docs/colors/yellow.png b/docs/colors/yellow.png
deleted file mode 100644
index 2b725ae..0000000
Binary files a/docs/colors/yellow.png and /dev/null differ
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 252f531..fb2ae22 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -39,43 +39,14 @@ const COLOR_FORMATS: &[&str] = &[
"hex",
];
-macro_rules! color_help_message {
- () => {
- "\
+const COLOR_HELP_MESSAGE: &str = "\
The input colors. Multiple colors can be specified. Supported formats:
-* HTML color name (e.g. 'rebeccapurple')
-* Hexadecimal RGB color (e.g. '07F', '0077FF')
-* Color components (e.g. '127, 0, 255', 'hsl(30, 1, .5)').
- If no color space is specified, it defaults to 'rgb'.
- Commas and parentheses are optional."
- };
-}
-
-macro_rules! color_space_help {
- () => {
- "\
-Supported color spaces
-======================
-name arguments values
--------------------------------------------------------------------
-rgb red, green, blue 0-255 0-255 0-255
-cmy cyan, magenta, yellow 0-1 0-1 0-1
-cmyk cyan, magenta, yellow, key 0-1 0-1 0-1 0-1
-hsv hue, saturation, value 0-360 0-1 0-1
-hsl hue, saturation, light 0-360 0-1 0-1
-lch luminance, chroma, hue 0-100 0-100 0-360
-luv luminance, u, v (CIELUV) 0-100 –134-220 –140-122
-lab lightness, a, b (CIELAB) 0-100 ? ?
-hunterlab lightness, a, b (CIELAB) 0-100 ? ?
-xyz x,y,z (CIE 1931 XYZ color) ? ? ?
-yxy y1,x,y2 (CIE YXY color) ? ? ?"
- };
-}
-
-const COLOR_HELP_LONG_MESSAGE: &str = concat!(color_help_message!(), "\n\n", color_space_help!());
-
-const COLOR_HELP_MESSAGE: &str = color_help_message!();
+* HTML color name, e.g. 'rebeccapurple'
+* Hexadecimal RGB color, e.g. '07F', '0077FF'
+* Color components, e.g. 'hsl(30, 100%, 50%)'
+ Commas and parentheses are optional.
+ For supported color spaces, see ";
/// Returns the command line arguments parsed by clap.
///
diff --git a/src/cli/show.rs b/src/cli/show.rs
index 653b1b8..90aba7d 100644
--- a/src/cli/show.rs
+++ b/src/cli/show.rs
@@ -16,7 +16,6 @@ pub fn command<'a, 'b>() -> App<'a, 'b> {
.takes_value(true)
.required(false)
.help(super::COLOR_HELP_MESSAGE)
- .long_help(super::COLOR_HELP_LONG_MESSAGE)
.multiple(true)
.use_delimiter(false),
Arg::with_name("OUTPUT_FORMAT")
diff --git a/src/color/parse.rs b/src/color/parse.rs
index c46c038..9293f01 100644
--- a/src/color/parse.rs
+++ b/src/color/parse.rs
@@ -78,8 +78,14 @@ pub fn parse(mut input: &str) -> Result, ParseError> {
let (n, input_ii) = parse_number(input_i)?.ok_or_else(|| MissingFloat {
got: input_i.into(),
})?;
- *num = n;
- input_i = input_ii;
+ input_i = input_ii.trim_start();
+
+ if input_i.starts_with('%') {
+ input_i = &input_i[1..];
+ *num = n / 100.0;
+ } else {
+ *num = n;
+ }
}
let nums = &nums[0..expected];