AshDiagram.Renderer behaviour (AshDiagram v0.1.2)
View SourceBehaviour for rendering AshDiagram diagrams.
Summary
Types
Single rendering option for customizing diagram output.
Callbacks
Render the diagram to the specified format.
Determine if the current environment supports this renderer.
Functions
Render the diagram to the specified format, using the configured renderer.
Types
@type color() :: String.t()
@type dimension() :: pos_integer()
@type format() :: :svg | :png | :pdf
@type option() :: {:theme, theme()} | {:format, format()} | {:width, dimension()} | {:height, dimension()} | {:background_color, color()} | {:config_file, Path.t()} | {:svg_id, String.t()} | {:scale, float()} | {:puppeteer_config_file, Path.t()} | {:icon_packs, [String.t()]}
Single rendering option for customizing diagram output.
Available Options
{:theme, theme()}
- Visual theme (:default
,:forest
,:dark
,:neutral
){:format, format()}
- Output format (:svg
,:png
,:pdf
){:width, dimension()}
- Output width in pixels{:height, dimension()}
- Output height in pixels{:background_color, color()}
- Background color (e.g.,"white"
,"#ffffff"
){:config_file, Path.t()}
- Path to Mermaid configuration file{:svg_id, String.t()}
- Custom SVG element ID{:scale, float()}
- Scale factor for output (e.g.,1.0
,2.0
){:puppeteer_config_file, Path.t()}
- Path to Puppeteer configuration{:icon_packs, [String.t()]}
- List of icon pack names
Examples
# Set dark theme with PNG output
[{:theme, :dark}, {:format, :png}]
# High resolution SVG with custom size
[{:format, :svg}, {:width, 1920}, {:height, 1080}, {:scale, 2.0}]
# PDF with custom background color
[{:format, :pdf}, {:background_color, "#f8f9fa"}]
@type options() :: [option()]
List of rendering options. See option/0
for available options.
@type theme() :: :default | :forest | :dark | :neutral