Skip to content

General Usage

Lucas Czech edited this page Sep 8, 2021 · 9 revisions

Colors

Many commands in gappa produce output visualizations that use colors. Depending on the context, these can either be single colors, or a list or gradient of colors.

Single Colors

Single colors can be specified

  • by name, as one of the 140 web colors, that is, the basic 16 html color names and the extended 124 X11 color names. This is case-independent and insensitive to white spaces.
  • by name, as one of the 954 xckd colors, again case- and white-space-insensitive.
  • by hex code in the format #RRGGBB or #RRGGBBAA (with alpha, which might be useful when producing svg fules), using hexadecimal coding for each of the red, green, and blue values, case insensitive. For example, use #000000 for black and #ffffff for white. Note that # also happens to denote the start of a comment in command lines; hence, you probably need to put this in quotation marks.

A typical color specification might hence look like this: --under-color "#ff00ff" or --mask-color orange.

Lists and Gradients of Colors

Gradients and lists of colors can be specified as

  • a comma-separated list of colors following the above specifications for single colors (this list can either be provided in a file with one color per line, or directly as a string on the command line), or
  • as one of the following named color lists/gradients:

Color lists in gappa.

Depending on context, not all of these lists might be available; it does for example not make much sense to use a (categorical) qualitative color list as a (continuous) gradient.

When specifying individual colors to build a custom gradient, the specified colors are evenly spaced out across the range of values, and then linearly interpolated to create the gradient. For example, a gradient from black to red to yellow could be specified as --color-list "#000000,#ff0000,#ffff00".

Our internal interpolation between colors to create a gradient (currently) is done linearly in RGB color space - this does not always yield the best looking results. We hence recommend to construct a gradient with several (5 or more) intermediate colors using external tools that operate in LCH space (e.g., this gradient generator), and then use these intermediate colors as input for gappa. This way, gappa needs to only interpolate between nearby similar colors in RGB, which works/looks better than RGB interpolation between vastly different colors.

Clone this wiki locally