AshWorkflow.Charts.Palette (AshWorkflow v0.10.1)

Copy Markdown View Source

The colours of the charts that AshWorkflow.Charts.Dot draws, for each theme. A backend that draws in colour reads them here, so every such chart has the same look.

The palette has one class for each step kind, terminal outcome and edge kind.

:light is for a light page. :dark is for a dark page, with deep fills, light strokes and light text.

Summary

Functions

The background colour of a chart, for a theme.

The colours of each class, for a theme: a keyword list from the class name to its colours. The classes are in this order

The colour of the edge label text, for a theme.

The class of a terminal step, from the kinds of the edges that reach it: :failed for on_error only, :expired for timeouts only, :done for transitions and on_success only, and :end for a mix or for no edge.

Types

class()

@type class() ::
  :automatic
  | :manual
  | :wait_state
  | :done
  | :failed
  | :expired
  | :end
  | :on_success
  | :on_error
  | :timeout
  | :undo

theme()

@type theme() :: :light | :dark

Functions

background(theme)

@spec background(theme()) :: String.t()

The background colour of a chart, for a theme.

colours(atom)

@spec colours(theme()) :: keyword(keyword(String.t()))

The colours of each class, for a theme: a keyword list from the class name to its colours. The classes are in this order:

  • :automatic, :manual and :wait_state, for the step kinds.
  • :done, :failed, :expired and :end, for terminal steps.
  • :on_success, :on_error, :timeout and :undo, for edges.

A step class has :fill and :stroke, and an edge class has :stroke. In the dark theme a step class also has :text, the colour of its label.

edge_label_colour(theme)

@spec edge_label_colour(theme()) :: String.t()

The colour of the edge label text, for a theme.

terminal_class(step, graph)

@spec terminal_class(atom(), AshWorkflow.Charts.Graph.t()) ::
  :done | :failed | :expired | :end

The class of a terminal step, from the kinds of the edges that reach it: :failed for on_error only, :expired for timeouts only, :done for transitions and on_success only, and :end for a mix or for no edge.

Undo edges leave a step and do not count. A step that a person chooses is :done, whatever its name.