Add a colormap

One JSON file for each map, with its source and its license

A colormap of the field presenters of Construct is data: one JSON file for each map. Mesh and tet items lists the maps that ship.

Write the file

Add one JSON file to src/libs/libstyle/resources/colormaps/. It needs no change to the code. The build ships every file in the folder, and the file name is the colormap's id.

{
	"name": "Blue, green, red",
	"comment": "What the map is for.",
	"kind": "rainbow",
	"source": "https://gitlab.com/octomy/octomy",
	"license": "LicenseRef-OctoMY",
	"space": "srgb",
	"stops": [
		{ "at": 0.0, "color": [0.05, 0.05, 0.95] },
		{ "at": 1.0, "color": [0.95, 0.05, 0.05] }
	]
}
  • kind is sequential, diverging, rainbow or bands.
  • source and license are required. license is an SPDX id.
  • at is a position from 0 to 1. Between two stops the color blends in a straight line in space.
  • space is srgb, linear or oklab. It tells how to read the color values and where to blend them.
  • "interpolation": "moreland" blends the first and the last stop as Moreland's diverging maps do.
  • A colormap needs at least two stops.
In this section
Topics
howto development construct colormap
See also