package color-brewery

  1. Overview
  2. Docs

Colormaps with certain characteristics.

type t

A color map.

val length : t -> int

length m returns the number of colors in the palette m.

val rgb : t -> rgba list

rgb m returns the RGB color range of the palette m.

val cmyk : t -> cmyk list

cmyk m returns the CMYK color range of the palette m.

val get_rgb : t -> int -> rgba

get_rgb m i return the ith RGB color of the palette m.

val get_cmyk : t -> int -> cmyk

get_cmyk m i return the ith CMYK color of the palette m.

val gradient : ?interpolate:bool -> t -> Gradient.t

gradient m returns a gradient constructed from the palette. It only makes sense for sequential and some diverging palettes.

  • parameter interpolate

    If false (the default), just map

val ty : t -> [ `Seq | `Div | `Qual ]

ty m says whether the palette is `Sequential, `Divergent or `Qualitative.

val blind : t -> [ `Yes | `No | `Maybe ]

blind m says whether the palette m is colorblind safe.

val print : t -> [ `Yes | `No | `Maybe ]

print m says whether the palette m is print friendly.

val copy : t -> [ `Yes | `No | `Maybe ]

print m says whether the palette m is photocopy safe.

val lcd : t -> [ `Yes | `No | `Maybe ]

print m says whether the palette m is friendly for LCD screens.

val find : ?ty:[ `Seq | `Div | `Qual ] -> ?blind:[ `Yes | `No | `Maybe ] -> ?print:[ `Yes | `No | `Maybe ] -> ?copy:[ `Yes | `No | `Maybe ] -> ?lcd:[ `Yes | `No | `Maybe ] -> int -> t list

find length return the list of palettes that support the desired properties and having at least length length. Note that most of the palette have ≤ 12 colors and the longer the palette, the less it will satisfy other properties. For properties selected with `Yes `No or `Maybe, setting `No (the default) means one does not care, setting `Maybe selects palettes that maybe (or for sure) satisfy the property and `Yes selects palettes that satisfy the property for sure.

  • ty, if provided, restricts maps to the color scheme:

    • `Seq: Sequential scheme
    • `Div: Diverging scheme
    • `Qual: Qualitative scheme
  • blind: the palette should be safe for color blind people.
  • print: the palette is print friendly.
  • copy: the palette is photocopy friendly.
  • lcd: the palette is LCD friendly.
val viridis : t

Matplotlib colormaps

These are sequential colormaps (each with 256 colors). You can find more information on this page.

val magma : t
val inferno : t
val plasma : t

ColorBrewer schemes

Color schemes as described in the paper: Brewer, Cynthia A., Geoffrey W. Hatchard and Mark A. Harrower, 2003, ColorBrewer in Print: A Catalog of Color Schemes for Maps, Cartography and Geographic Information Science 30(1): 5-32.

See also www.ColorBrewer.org

Sequential schemes

val ylgn : t list

Light yellow to dark green

val ylgnbu : t list

Light yellow to green to dark blue

val gnbu : t list

Light green to dark blue

val bugn : t list

Light blue to dark green

val pubugn : t list

Light purple to blue to dark green

val pubu : t list

Light purple to dark blue

val bupu : t list

Light blue to dark purple

val rdpu : t list

Light red to dark purple

val purd : t list

Light purple to dark red

val orrd : t list

Light orange to dark red

val ylorrd : t list

Light yellow to orange to dark red

val ylorbr : t list

Light yellow to orange to dark brown

Sequential schemes, single hue

val purples : t list

Light to dark purple

val blues : t list

Light to dark blue

val greens : t list

Light to dark green

val oranges : t list

Light to dark oranges

val reds : t list

Light to dark red

val greys : t list

Light to dark gray

Diverging schemes

val puor : t list

Dark orange to light to dark purple

val brbg : t list

Dark brown to light to dark blue-green

val prgn : t list

Dark reddish-purple to light to dark green

val piyg : t list

Dark magenta to light to dark yellow-green

val rdbu : t list

Dark red to light to dark blue

val rdgy : t list

Dark red to light to dark grey

val rdylbu : t list

Dark red to light yelow to dark blue

val spectral : t list

Dark red, orange, light yellow, green, dark blue

val rdylgn : t list

Dark red, orange, light yellow, yellow-green, dark green

Qualitative schemes

val set1 : t list

Includes bold, readily named, basic colors (such as red, green, blue)

val pastel1 : t list

Lighter version of Set1

val set2 : t list

Includes mostly a mixture colors (such as blue-green, red-orange)

val pastel2 : t list

Lighter version of Set2

val dark2 : t list

Darker version of Set2

val set3 : t list

Medium saturation set with more lightness variation and more classes than Set1 and Set2.

val paired : t list

Light/dark paris for namable hues

val accent : t list

Include lightness and saturation extremes to accent small or important areas