SankeyMATIC Manual

Colors

Setting Colors for All Nodes

Theme A:
D3 scale category20
Theme B:
D3 scale category20b
Theme C:
D3 scale category20c

In the Colors control panel, you can have SankeyMATIC assign colors to your Nodes from the themes shown on the right.

Or you can choose to set all Nodes to a single color that you specify.

For help choosing specific HTML color codes, there are many sites you can visit for help; search for HTML color codes.

Setting Colors for All Flows

Example using Source colors
Use Source color

Example using Target colors
Use Target color

Example of one Flow color
Use a single color
(gray here)

In the Colors control panel, for Flow Colors you have three choices:

  • Use the Source Node's color: Every Flow will adopt the color of the Node it is flowing from.
  • Use the Target Node's color: Every Flow will adopt the color of the Node it is flowing to.
  • Use a single color for all flows.

Note: Since Flows are more transparent than Nodes by default, a color code applied to a Flow will appear to be a lightened version of the same color applied to a Node.


To control the transparency/opacity of all Flows, use the “Flow Opacity” slider.

The closer you get to 1.0, the brighter the colors will be. However, if any Flows cross over each other, a higher opacity will make it harder to follow those paths.

Setting Individual Node Colors

You can set one specific Node's color by adding a Node definition line to the “Inputs” field, in this format:

:Node-name #Color

Sample:
:Surplus #006600

Example: Set the Node color for “A” to red (#CC0000) and for “C” to green:
Basic Sankey diagram example with custom Node colors

Note: Node definition lines can occur anywhere in the input; they are not required to be in a specific order.

Setting Individual Flow Colors & Opacity

You can set one specific Flow's color by adding a color code to the end of that Flow's data line, like so:

Source [Number] Target #Color

Example: Set the first Flow to green, the second to blue, and leave the third with its default color:
Sankey example with custom Flow colors

To customize the opacity of an individual Flow, attach to the end of the color code a number between .0 and .9999:

Source [Number] Target #Color.Opacity

Example: Set the first Flow to red with .9 opacity, set the second to green with .4 opacity, and leave the third with its default appearance:
Sankey example with custom Flow colors and opacities

Setting Flow Colors to Inherit from Specific Nodes

You can override the general settings for Flow colors for a specific Node by using these special tokens:

>> = use this Node's color for Flows from it.

<< = use this Node's color for Flows to it.

Examples:

Flows from the Node inherit its color:
:Node-name #Color >>

Sankey example with custom Node color inheriting rightward

Flows to the Node inherit its color:
:Node-name #Color <<

Sankey example with custom Node color inheriting leftward

Flows to and from the Node inherit its color:
:Node-name #Color >> <<
or
:Node-name #Color << >>

Sankey example with custom Node color inheriting in both directions

Color Precedence Rules

For Flows:

  • A Flow’s color can be set by four different methods.
    There is a strict precedence to how a Flow’s color is resolved, from most specific to least specific:

    1. If the Flow's line in the source data specifies a color, use that.
    2. If the Flow’s Source Node declares that Flows from it should use its color, adopt the Source Node's color.
    3. If the Flow’s Target Node declares that Flows to it should use its color, adopt the Target Node's color.
    4. Use the Default Flow Color as set in the “Colors” control panel.
      (This could be set to a general rule indicating all Flows should inherit their colors from their Source Node or Target Node, or a single specific Color could be set for all Flows.)

For Nodes:

  • A Node’s color can be set by two different methods.
    Each Node’s color is resolved as follows:

    1. If there is a Node Definition line specifying a color, use that.
    2. Use the Default Node Color as set in the “Colors” section of the controls.
      (This could be a single Color entered by the user or a color chosen by SankeyMATIC from a color Theme selected by the user.)