MCPcopy Index your code
hub / github.com/dtolnay/colorous

github.com/dtolnay/colorous @1.0.16

Chat with this repo
repository ↗ · DeepWiki ↗ · release 1.0.16 ↗ · + Follow
51 symbols 81 edges 17 files 3 documented · 6%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Colorous

github crates.io docs.rs build status

This crate provides a collection of sequential, diverging and categorical color schemes ported from d3-scale-chromatic. Each color scheme may be sampled using either a rational index i/n or a continuous float 0 ≤ t ≤ 1.

  • pub fn eval_rational(&self, i: usize, n: usize) -> Color
  • pub fn eval_continuous(&self, t: f64) -> Color

viridis

Example

let gradient = colorous::VIRIDIS;
for i in 0..100 {
    println!("{:x}", gradient.eval_rational(i, 100));
}

Sequential (multi-hue)

# colorous::TURBO

turbo

The “turbo” color scheme by Anton Mikhailov.

# colorous::VIRIDIS

viridis

The “viridis” perceptually-uniform color scheme designed by van der Walt, Smith and Firing for matplotlib.

# colorous::INFERNO

inferno

The “inferno” perceptually-uniform color scheme designed by van der Walt and Smith for matplotlib.

# colorous::MAGMA

magma

The “magma” perceptually-uniform color scheme designed by van der Walt and Smith for matplotlib.

# colorous::PLASMA

plasma

The “plasma” perceptually-uniform color scheme designed by van der Walt and Smith for matplotlib.

# colorous::CIVIDIS

cividis

The “cividis” color vision deficiency-optimized color scheme designed by Nuñez, Anderton, and Renslow.

# colorous::WARM

warm

A 180° rotation of Niccoli’s perceptual rainbow.

# colorous::COOL

cool

Niccoli’s perceptual rainbow.

# colorous::CUBEHELIX

cubehelix

Green’s default Cubehelix.

# colorous::BLUE_GREEN

BuGn

# colorous::BLUE_PURPLE

BuPu

# colorous::GREEN_BLUE

GnBu

# colorous::ORANGE_RED

OrRd

# colorous::PURPLE_BLUE_GREEN

PuBuGn

# colorous::PURPLE_BLUE

PuBu

# colorous::PURPLE_RED

PuRd

# colorous::RED_PURPLE

RdPu

# colorous::YELLOW_GREEN_BLUE

YlGnBu

# colorous::YELLOW_GREEN

YlGn

# colorous::YELLOW_ORANGE_BROWN

YlOrBr

# colorous::YELLOW_ORANGE_RED

YlOrRd

Sequential (single-hue)

# colorous::BLUES

Blues

# colorous::GREENS

Greens

# colorous::GREYS

Greys

# colorous::ORANGES

Oranges

# colorous::PURPLES

Purples

# colorous::REDS

Reds

Diverging

# colorous::BROWN_GREEN

BrBG

# colorous::PURPLE_GREEN

PRGn

# colorous::PINK_GREEN

PiYG

# colorous::PURPLE_ORANGE

PuOr

# colorous::RED_BLUE

RdBu

# colorous::RED_GREY

RdGy

# colorous::RED_YELLOW_BLUE

RdYlBu

# colorous::RED_YELLOW_GREEN

RdYlGn

# colorous::SPECTRAL

Spectral

Cyclical

# colorous::RAINBOW

rainbow

The cyclical less-angry rainbow color scheme.

# colorous::SINEBOW

sinebow

The “sinebow” color scheme by Jim Bumgardner and Charlie Loyd.

Categorical

Categorical color schemes are exposed simply as an array [Color; N].

# colorous::CATEGORY10

category10

# colorous::ACCENT

Accent

# colorous::DARK2

Dark2

# colorous::PAIRED

Paired

# colorous::PASTEL1

Pastel1

# colorous::PASTEL2

Pastel2

# colorous::SET1

Set1

# colorous::SET2

Set2

# colorous::SET3

Set3

# colorous::TABLEAU10

Tableau10

Ten categorical colors authored by Tableau as part of Tableau 10.

License

Licensed under the Apache License, Version 2.0.

Extension points exported contracts — how you extend this code

EvalGradient (Interface)
(no doc) [8 implementers]
src/gradient.rs

Core symbols most depended-on inside this repo

sin
called by 4
src/math.rs
color_value
called by 3
src/sequential_multi.rs
basis
called by 3
src/interpolate.rs
spline
called by 3
src/interpolate.rs
eval_rational
called by 3
src/gradient.rs
eval_continuous
called by 2
src/gradient.rs
as_array
called by 2
src/color.rs
eval_rational
called by 2
src/cyclical.rs

Shape

Method 22
Function 17
Class 11
Interface 1

Languages

Rust100%

Modules by API surface

src/sequential_multi.rs7 symbols
src/color.rs7 symbols
src/gradient.rs6 symbols
src/cyclical.rs6 symbols
src/sequential.rs4 symbols
src/math_nostd.rs4 symbols
src/math.rs4 symbols
src/diverging.rs4 symbols
src/cubehelix.rs3 symbols
src/interpolate.rs2 symbols
tests/test_eval.rs1 symbols
tests/test_color.rs1 symbols

For agents

$ claude mcp add colorous \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page