Introduction to ColorSchemes
This package provides a collection of colorschemes:
- scientifically devised colorschemes from ColorBrewer, CMOcean, ScientificColorMaps, ColorCet, and Seaborn
- popular favourites such as viridis, inferno, and magma from MATPlotLib
- variously themed colorschemes such as sunset, coffee, neon, and pearl
- artistic colorschemes, such as leonardo, vermeer, picasso, Degas, Hiroshige,
Note that the schemes contained here are a mixture:
- some are high quality color maps with consistent perceptual contrast over their full range
- others are designed for general purpose and informal graphics work
Choose colorschemes with care! See the Good practice section, and also refer to Peter Kovesi's PerceptualColourMaps package, or to Fabio Crameri's Scientific Colour Maps for technical information.
This package relies on the Colors.jl package.
If you want to make more advanced ColorSchemes, use linear-segment dictionaries or indexed lists, and use functions to generate color values, see the make_colorscheme() function in the ColorSchemeTools.jl package.
Installation and basic usage
Install the package as follows:
import PkgPkg.add("ColorSchemes")or, at the REPL:
] add ColorSchemesUsage:
using ColorSchemesColorSchemes.Purples_5 # => a ColorScheme colorschemes[:Purples_5]# => a ColorScheme ColorSchemes.Purples_5.colors# => array of five RGB colorsColorSchemes.Purples_5.colors[3]# => the third color in the colorschemeget(ColorSchemes.Purples_5, 0.5)# => the midway point of the colorscheme colorschemes# => Dict{Symbol, ColorScheme} with 1150 entriesfindcolorscheme("purple")# => display list of matching schemesColorScheme([colorant"red", colorant"green", colorant"blue"])# new colorscheme from Colors.jl named colorsget(ColorSchemes.darkrainbow, range(0.0, 1.0, length=20)) |> ColorScheme# new colorscheme by resampling existingresample(ColorSchemes.darkrainbow, 20)# new colorscheme by resampling using `resample()` Original version by cormullion.
Contributing a new colorscheme
If you think a new colorscheme would be a great addition for you and for Julians everywhere, you can contribute it as follows:
Add a file to the
data/directory. The file should be a Julia file, with a.jlsuffix.Inside the file, define a colorscheme in this format, which calls loadcolorscheme:
loadcolorscheme(:mynewcolorscheme, [ RGB(0.0, 0.0, 0.0), RGB(0.5, 0.5, 0.5), RGB(1.0, 1.0, 1.0), ], "category for my new scheme", # the category "black, white, and grey" # some descriptive keywords )The new name - here mynewcolorscheme - should be a valid Julia variable name.
If you're adding the new colorscheme to an existing category, it will appear in the catalog document automatically.
Otherwise, to add a new category to the catalog (which will add all the colorschemes in that category), add this code to
catalogue.md:
```@example catalog
using Luxor, ColorSchemes # hide
ColorSchemeCategory("category for my new scheme") # hide
```If there's a license file, add it to
data/as well. (This is a courtesy thing rather than a legal thing.)Add your new file to the include list in the function
src/ColorSchemes.jl/loadallschemes(around line 118).
Documentation
This documentation was built using Documenter.jl.
Documentation built 2026-08-14T11:40:56.920 with Julia 1.12.6