package color-brewery

  1. Overview
  2. Docs

Module Color_brewery.PaletteSource

Colormaps with certain characteristics.

Sourcetype t

A color map.

Sourceval length : t -> int

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

Sourceval rgb : t -> rgba list

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

Sourceval cmyk : t -> cmyk list

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

Sourceval get_rgb : t -> int -> rgba

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

Sourceval get_cmyk : t -> int -> cmyk

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

Sourceval 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

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

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

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

blind m says whether the palette m is colorblind safe.

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

print m says whether the palette m is print friendly.

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

print m says whether the palette m is photocopy safe.

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

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

Sourceval 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.
Sourceval viridis : t

Matplotlib colormaps

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

Sourceval magma : t
Sourceval inferno : t
Sourceval 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

Sourceval ylgn : t list

Light yellow to dark green

Sourceval ylgnbu : t list

Light yellow to green to dark blue

Sourceval gnbu : t list

Light green to dark blue

Sourceval bugn : t list

Light blue to dark green

Sourceval pubugn : t list

Light purple to blue to dark green

Sourceval pubu : t list

Light purple to dark blue

Sourceval bupu : t list

Light blue to dark purple

Sourceval rdpu : t list

Light red to dark purple

Sourceval purd : t list

Light purple to dark red

Sourceval orrd : t list

Light orange to dark red

Sourceval ylorrd : t list

Light yellow to orange to dark red

Sourceval ylorbr : t list

Light yellow to orange to dark brown

Sequential schemes, single hue

Sourceval purples : t list

Light to dark purple

Sourceval blues : t list

Light to dark blue

Sourceval greens : t list

Light to dark green

Sourceval oranges : t list

Light to dark oranges

Sourceval reds : t list

Light to dark red

Sourceval greys : t list

Light to dark gray

Diverging schemes

Sourceval puor : t list

Dark orange to light to dark purple

Sourceval brbg : t list

Dark brown to light to dark blue-green

Sourceval prgn : t list

Dark reddish-purple to light to dark green

Sourceval piyg : t list

Dark magenta to light to dark yellow-green

Sourceval rdbu : t list

Dark red to light to dark blue

Sourceval rdgy : t list

Dark red to light to dark grey

Sourceval rdylbu : t list

Dark red to light yelow to dark blue

Sourceval spectral : t list

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

Sourceval rdylgn : t list

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

Qualitative schemes

Sourceval set1 : t list

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

Sourceval pastel1 : t list

Lighter version of Set1

Sourceval set2 : t list

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

Sourceval pastel2 : t list

Lighter version of Set2

Sourceval dark2 : t list

Darker version of Set2

Sourceval set3 : t list

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

Sourceval paired : t list

Light/dark paris for namable hues

Sourceval accent : t list

Include lightness and saturation extremes to accent small or important areas

OCaml

Innovation. Community. Security.