• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

examples/H03-May-2022-127115

src/H03-May-2022-1,505958

tests/H03-May-2022-7469

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D27-Apr-202074 65

.gitignoreH A D27-Apr-202034 43

.travis.ymlH A D27-Apr-2020542 2420

Cargo.lockH A D27-Apr-202025.1 KiB566504

Cargo.tomlH A D27-Apr-20201.2 KiB4035

Cargo.toml.orig-cargoH A D27-Apr-2020641 2521

LICENSE-APACHEH A D27-Apr-202010.6 KiB202169

NOTICEH A D27-Apr-20202.3 KiB5238

README.mdH A D27-Apr-202011.5 KiB271141

README.md

1Colorous
2========
3
4[![Build Status](https://api.travis-ci.com/dtolnay/colorous.svg?branch=master)](https://travis-ci.com/dtolnay/colorous)
5[![Latest Version](https://img.shields.io/crates/v/colorous.svg)](https://crates.io/crates/colorous)
6[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/colorous)
7
8This crate provides a collection of sequential, diverging and categorical color
9schemes ported from [d3-scale-chromatic]. Each color scheme may be sampled using
10either a rational index `i/n` or a continuous float `0 ≤ t ≤ 1`.
11
12- `pub fn eval_rational(&self, i: usize, n: usize) -> Color`
13- `pub fn eval_continuous(&self, t: f64) -> Color`
14
15[d3-scale-chromatic]: https://github.com/d3/d3-scale-chromatic
16
17<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/viridis.png" width="100%" height="10" alt="viridis">
18
19## Example
20
21```rust
22let gradient = colorous::VIRIDIS;
23for i in 0..100 {
24    println!("{:x}", gradient.eval_rational(i, 100));
25}
26```
27
28<br>
29
30## Sequential (multi-hue)
31
32<a href="#Turbo" name="Turbo">#</a> colorous::<b>TURBO</b>
33
34<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/turbo.png" width="100%" height="40" alt="turbo">
35
36The “turbo” color scheme by [Anton Mikhailov](https://ai.googleblog.com/2019/08/turbo-improved-rainbow-colormap-for.html).
37
38<a href="#Viridis" name="Viridis">#</a> colorous::<b>VIRIDIS</b>
39
40<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/viridis.png" width="100%" height="40" alt="viridis">
41
42The “viridis” perceptually-uniform color scheme designed by [van der Walt, Smith and Firing](https://bids.github.io/colormap/) for matplotlib.
43
44<a href="#Inferno" name="Inferno">#</a> colorous::<b>INFERNO</b>
45
46<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/inferno.png" width="100%" height="40" alt="inferno">
47
48The “inferno” perceptually-uniform color scheme designed by [van der Walt and Smith](https://bids.github.io/colormap/) for matplotlib.
49
50<a href="#Magma" name="Magma">#</a> colorous::<b>MAGMA</b>
51
52<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/magma.png" width="100%" height="40" alt="magma">
53
54The “magma” perceptually-uniform color scheme designed by [van der Walt and Smith](https://bids.github.io/colormap/) for matplotlib.
55
56<a href="#Plasma" name="Plasma">#</a> colorous::<b>PLASMA</b>
57
58<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/plasma.png" width="100%" height="40" alt="plasma">
59
60The “plasma” perceptually-uniform color scheme designed by [van der Walt and Smith](https://bids.github.io/colormap/) for matplotlib.
61
62<a href="#Cividis" name="Cividis">#</a> colorous::<b>CIVIDIS</b>
63
64<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/cividis.png" width="100%" height="40" alt="cividis">
65
66The “cividis” color vision deficiency-optimized color scheme designed by [Nuñez, Anderton, and Renslow](https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0199239).
67
68<a href="#Warm" name="Warm">#</a> colorous::<b>WARM</b>
69
70<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/warm.png" width="100%" height="40" alt="warm">
71
72A 180° rotation of [Niccoli’s perceptual rainbow](https://mycarta.wordpress.com/2013/02/21/perceptual-rainbow-palette-the-method/).
73
74<a href="#Cool" name="Cool">#</a> colorous::<b>COOL</b>
75
76<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/cool.png" width="100%" height="40" alt="cool">
77
78[Niccoli’s perceptual rainbow](https://mycarta.wordpress.com/2013/02/21/perceptual-rainbow-palette-the-method/).
79
80<a href="#CubehelixDefault" name="CubehelixDefault">#</a> colorous::<b>CUBEHELIX</b>
81
82<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/cubehelix.png" width="100%" height="40" alt="cubehelix">
83
84[Green’s default Cubehelix](https://www.mrao.cam.ac.uk/~dag/CUBEHELIX/).
85
86<a href="#BuGn" name="BuGn">#</a> colorous::<b>BLUE_GREEN</b>
87
88<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/BuGn.png" width="100%" height="40" alt="BuGn">
89
90<a href="#BuPu" name="BuPu">#</a> colorous::<b>BLUE_PURPLE</b>
91
92<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/BuPu.png" width="100%" height="40" alt="BuPu">
93
94<a href="#GnBu" name="GnBu">#</a> colorous::<b>GREEN_BLUE</b>
95
96<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/GnBu.png" width="100%" height="40" alt="GnBu">
97
98<a href="#OrRd" name="OrRd">#</a> colorous::<b>ORANGE_RED</b>
99
100<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/OrRd.png" width="100%" height="40" alt="OrRd">
101
102<a href="#PuBuGn" name="PuBuGn">#</a> colorous::<b>PURPLE_BLUE_GREEN</b>
103
104<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/PuBuGn.png" width="100%" height="40" alt="PuBuGn">
105
106<a href="#PuBu" name="PuBu">#</a> colorous::<b>PURPLE_BLUE</b>
107
108<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/PuBu.png" width="100%" height="40" alt="PuBu">
109
110<a href="#PuRd" name="PuRd">#</a> colorous::<b>PURPLE_RED</b>
111
112<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/PuRd.png" width="100%" height="40" alt="PuRd">
113
114<a href="#RdPu" name="RdPu">#</a> colorous::<b>RED_PURPLE</b>
115
116<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/RdPu.png" width="100%" height="40" alt="RdPu">
117
118<a href="#YlGnBu" name="YlGnBu">#</a> colorous::<b>YELLOW_GREEN_BLUE</b>
119
120<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/YlGnBu.png" width="100%" height="40" alt="YlGnBu">
121
122<a href="#YlGn" name="YlGn">#</a> colorous::<b>YELLOW_GREEN</b>
123
124<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/YlGn.png" width="100%" height="40" alt="YlGn">
125
126<a href="#YlOrBr" name="YlOrBr">#</a> colorous::<b>YELLOW_ORANGE_BROWN</b>
127
128<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/YlOrBr.png" width="100%" height="40" alt="YlOrBr">
129
130<a href="#YlOrRd" name="YlOrRd">#</a> colorous::<b>YELLOW_ORANGE_RED</b>
131
132<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/YlOrRd.png" width="100%" height="40" alt="YlOrRd">
133
134<br>
135
136## Sequential (single-hue)
137
138<a href="#Blues" name="Blues">#</a> colorous::<b>BLUES</b>
139
140<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/Blues.png" width="100%" height="40" alt="Blues">
141
142<a href="#Greens" name="Greens">#</a> colorous::<b>GREENS</b>
143
144<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/Greens.png" width="100%" height="40" alt="Greens">
145
146<a href="#Greys" name="Greys">#</a> colorous::<b>GREYS</b>
147
148<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/Greys.png" width="100%" height="40" alt="Greys">
149
150<a href="#Oranges" name="Oranges">#</a> colorous::<b>ORANGES</b>
151
152<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/Oranges.png" width="100%" height="40" alt="Oranges">
153
154<a href="#Purples" name="Purples">#</a> colorous::<b>PURPLES</b>
155
156<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/Purples.png" width="100%" height="40" alt="Purples">
157
158<a href="#Reds" name="Reds">#</a> colorous::<b>REDS</b>
159
160<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/Reds.png" width="100%" height="40" alt="Reds">
161
162<br>
163
164## Diverging
165
166<a href="#BrBG" name="BrBG">#</a> colorous::<b>BROWN_GREEN</b>
167
168<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/BrBG.png" width="100%" height="40" alt="BrBG">
169
170<a href="#PRGn" name="PRGn">#</a> colorous::<b>PURPLE_GREEN</b>
171
172<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/PRGn.png" width="100%" height="40" alt="PRGn">
173
174<a href="#PiYG" name="PiYG">#</a> colorous::<b>PINK_GREEN</b>
175
176<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/PiYG.png" width="100%" height="40" alt="PiYG">
177
178<a href="#PuOr" name="PuOr">#</a> colorous::<b>PURPLE_ORANGE</b>
179
180<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/PuOr.png" width="100%" height="40" alt="PuOr">
181
182<a href="#RdBu" name="RdBu">#</a> colorous::<b>RED_BLUE</b>
183
184<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/RdBu.png" width="100%" height="40" alt="RdBu">
185
186<a href="#RdGy" name="RdGy">#</a> colorous::<b>RED_GREY</b>
187
188<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/RdGy.png" width="100%" height="40" alt="RdGy">
189
190<a href="#RdYlBu" name="RdYlBu">#</a> colorous::<b>RED_YELLOW_BLUE</b>
191
192<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/RdYlBu.png" width="100%" height="40" alt="RdYlBu">
193
194<a href="#RdYlGn" name="RdYlGn">#</a> colorous::<b>RED_YELLOW_GREEN</b>
195
196<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/RdYlGn.png" width="100%" height="40" alt="RdYlGn">
197
198<a href="#Spectral" name="Spectral">#</a> colorous::<b>SPECTRAL</b>
199
200<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/Spectral.png" width="100%" height="40" alt="Spectral">
201
202<br>
203
204## Cyclical
205
206<a href="#Rainbow" name="Rainbow">#</a> colorous::<b>RAINBOW</b>
207
208<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/rainbow.png" width="100%" height="40" alt="rainbow">
209
210The cyclical [less-angry rainbow](http://bl.ocks.org/mbostock/310c99e53880faec2434) color scheme.
211
212<a href="#Sinebow" name="Sinebow">#</a> colorous::<b>SINEBOW</b>
213
214<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/sinebow.png" width="100%" height="40" alt="sinebow">
215
216The “sinebow” color scheme by [Jim Bumgardner](https://krazydad.com/tutorials/makecolors.php) and [Charlie Loyd](http://basecase.org/env/on-rainbows).
217
218<br>
219
220## Categorical
221
222Categorical color schemes are represented simply as an array `[Color; N]`.
223
224<a href="#Category10" name="Category10">#</a> colorous::<b>CATEGORY10</b>
225
226<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/category10.png" width="100%" height="40" alt="category10">
227
228<a href="#Accent" name="Accent">#</a> colorous::<b>ACCENT</b>
229
230<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/Accent.png" width="100%" height="40" alt="Accent">
231
232<a href="#Dark2" name="Dark2">#</a> colorous::<b>DARK2</b>
233
234<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/Dark2.png" width="100%" height="40" alt="Dark2">
235
236<a href="#Paired" name="Paired">#</a> colorous::<b>PAIRED</b>
237
238<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/Paired.png" width="100%" height="40" alt="Paired">
239
240<a href="#Pastel1" name="Pastel1">#</a> colorous::<b>PASTEL1</b>
241
242<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/Pastel1.png" width="100%" height="40" alt="Pastel1">
243
244<a href="#Pastel2" name="Pastel2">#</a> colorous::<b>PASTEL2</b>
245
246<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/Pastel2.png" width="100%" height="40" alt="Pastel2">
247
248<a href="#Set1" name="Set1">#</a> colorous::<b>SET1</b>
249
250<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/Set1.png" width="100%" height="40" alt="Set1">
251
252<a href="#Set2" name="Set2">#</a> colorous::<b>SET2</b>
253
254<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/Set2.png" width="100%" height="40" alt="Set2">
255
256<a href="#Set3" name="Set3">#</a> colorous::<b>SET3</b>
257
258<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/Set3.png" width="100%" height="40" alt="Set3">
259
260<a href="#Tableau10" name="Tableau10">#</a> colorous::<b>TABLEAU10</b>
261
262<img src="https://raw.githubusercontent.com/dtolnay/colorous/readme/Tableau10.png" width="100%" height="40" alt="Tableau10">
263
264Ten categorical colors authored by Tableau as part of [Tableau 10](https://www.tableau.com/about/blog/2016/7/colors-upgrade-tableau-10-56782).
265
266<br>
267
268## License
269
270Licensed under the <a href="LICENSE-APACHE">Apache License, Version 2.0</a>.
271