cdor

package module
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2024 License: MIT Imports: 27 Imported by: 1

README

cdor

Generate diagrams with Go+/Go code.

cdor vs d2

cdor is inspired and powered by d2, the difference is:

d2 is a DSL (Domain Specific Language), But cdor is SDF (Specific Domain Friendliness), we just write common programming laguages (Go+/Go) to generate diagrams.

examples

hello md latex sql_table jsonn icon shapes near

see doc for details.

usage

Initialize your diagram project

mkdir demo
cd demo
gop mod init demo
gop get github.com/zrcoder/cdor@latest
cases
single diagram

create main_cdor.gox, with content like:

con "x", "y"

saveFile "hi.svg"

then run:

gop mod tidy
gop run .
multiple diagrams

create hi1_cdor.gox with content:

con "x", "y"

create hi2_cdor.gox with content:

con "a", "b"

modify main_cdor.gox to:

saveFiles ""

after gop run, you'll find hi1.svg and hi2.svg generated.

merge diagrams

you can merge all diagrams into a single diagram, and even creat more nodes and connections based on the sub diagrams, for example, modify main_cdor.gox to:

con "a", "x"
merge().saveFile "merged.svg"

after gop run, we got a generated merged.svg.

we can also merge specific diagrams by their names:

merge("hi1", "hi2").saveFile("res.svg")
range diagrams

you can range all the diagrams:

rangeCdors (name, cdor, err) => {
    // do something with cdor
}

or range part of the diagrams:

rangeCdors (name, cdor, err) => {
    // do somthing with cdor
}, "hi1", "hi2"

Documentation

Overview

Example (Animated)
c := Ctx()
c.Scon("x", "y").Animated()
fmt.Println(c.d2())
Output:

x -> y: {style.animated: true}
Example (BoldItalicUnderline)
c := Ctx()
c.Node("x").Underline()
c.Node("y").Italic()
c.Scon("x", "y").Label("hi").Bold()
fmt.Println(c.d2())
Output:

x: {style.underline: true}
y: {style.italic: true}
x -> y: hi {style.bold: true}
Example (BorderRadius)
c := Ctx()
c.Node("x").BorderRadius(3)
c.Node("y").BorderRadius(8)
c.Scon("x", "y").Label("hi")
fmt.Println(c.d2())
Output:

x: {style.border-radius: 3}
y: {style.border-radius: 8}
x -> y: hi
Example (Class)
c := Ctx()
c.Class("MyClass").
	Field("field", "[]string").
	Field("method(a uint64)", "(x, y int)").
	Field(`# peekn(n int)`, "(s string, eof bool)")
fmt.Println(c.d2())
Output:

MyClass: {
  shape: class
  field: "[]string"
  method(a uint64): (x, y int)
  \# peekn(n int): (s string, eof bool)
}
Example (Code)
c := Ctx()
c.Code("markdown", "md", `# Hi cdor
	- Go+
	- Go
	`)
c.Code("latex", "latex", `\lim_{h \rightarrow 0 } \frac{f(x+h)-f(x)}{h}`)
fmt.Println(c.d2())
Output:

markdown: |md
  # Hi cdor
  	- Go+
  	- Go
|
latex: |latex \\lim_{h \\rightarrow 0 } \\frac{f(x+h)-f(x)}{h} |
Example (Connection)
c := Ctx()
c.Con("x", "y").Stroke("red")
c.Con("x", "y").Stroke("blue")
fmt.Println(c.d2())
Output:

x <-> y: {style.stroke: red}
x <-> y: {style.stroke: blue}
Example (Connection_arrow)
c := Ctx()
c.Con("x", "y").
	Stroke("red").
	SrcHeadLabel("from").SrcHeadShape(c.HeadArrow()).
	DstHeadLabel("to").DstHeadShape(c.HeadDiamond()).DstHeadFilled()
fmt.Println(c.d2())
Output:

x <-> y: {
  style.stroke: red
  target-arrowhead.style.filled: true
  source-arrowhead.label: from
  source-arrowhead.shape: arrow
  target-arrowhead.label: to
  target-arrowhead.shape: diamond
}
Example (Container)
c := Ctx()
c.Node("server.process")
c.Node("im a parent.im a child")
c.Con("apartment.Bedroom.Bathroom", "office.Spare Room.Bathroom").Label("Portal")
fmt.Println(c.d2())
Output:

server.process
im a parent.im a child
apartment.Bedroom.Bathroom <-> office.Spare Room.Bathroom: Portal
Example (D2)
c := Ctx()
c.D2(`x -> y: hi`)
c.Direction(c.Right())
c.Con("Go+", "Go").Label("cdor")
fmt.Println(c.d2())
Output:

x -> y: hi
direction: right
Go+ <-> Go: cdor
Example (DoubleBorder)
c := Ctx()
c.Node("x").DoubleBorder()
c.Circle("y").DoubleBorder()
c.Scon("x", "y").Label("hi")
fmt.Println(c.d2())
Output:

x: {style.double-border: true}
y: {
  shape: circle
  style.double-border: true
}
x -> y: hi
Example (Fillpattern)
c := Ctx()
c.Direction(c.Right())
c.FillPattern(c.Dots())
c.Node("x").FillPattern(c.Lines())
c.Node("y").FillPattern(c.Grain())
c.Scon("x", "y").Label("hi")
fmt.Println(c.d2())
Output:

direction: right
style.fill-pattern: dots
x: {style.fill-pattern: lines}
y: {style.fill-pattern: grain}
x -> y: hi
Example (Font)
c := Ctx()
c.Node("x").Font("mono").FontSize(8)
c.Node("y").Font("mono").FontSize(55).FontColor("#f4a261")
c.Scon("x", "y").Label("hi").Font("mono").FontSize(28).FontColor("red")
fmt.Println(c.d2())
Output:

x: {
  style.font-size: 8
  style.font: mono
}
y: {
  style.font-size: 55
  style.font-color: "#f4a261"
  style.font: mono
}
x -> y: hi {
  style.font-size: 28
  style.font-color: red
  style.font: mono
}
Example (Grid)
c := Ctx()
c.GridRows(2).GridCols(4).GridGap(0)

c.Node("Element")
c.Node("Atomic Number")
c.Node("Atomic Mass")
c.Node("Melting Point")

c.Node("Hydrogen")
c.Node(`"1"`)
c.Node(`"1.008"`)
c.Node(`"-259.16"`)

c.Node("Carbon")
c.Node(`"6"`)
c.Node(`"12.011"`)
c.Node(`"3500"`)

c.Node("Oxygen")
c.Node(`"8"`)
c.Node(`"15.999"`)
c.Node(`"-218.79"`)

fmt.Println(c.d2())
Output:

grid-rows: 2
grid-columns: 4
grid-gap: 0
Element
Atomic Number
Atomic Mass
Melting Point
Hydrogen
"1"
"1.008"
"-259.16"
Carbon
"6"
"12.011"
"3500"
Oxygen
"8"
"15.999"
"-218.79"
Example (Hello)
c := Ctx()
c.Direction(c.Right())
c.Con("Go+", "Go").Label("cdor")
fmt.Println(c.d2())
Output:

direction: right
Go+ <-> Go: cdor
Example (Icon)
c := Ctx()
c.Node("github").Icon("https://icons.terrastruct.com/dev/github.svg")
c.Image("gg").Icon("https://icons.terrastruct.com/dev/github.svg")
fmt.Println(c.d2())
Output:

github: {icon: https://icons.terrastruct.com/dev/github.svg}
gg: {
  icon: https://icons.terrastruct.com/dev/github.svg
  shape: image
}
Example (Id)
c := Ctx()
c.Node("imAShape")
c.Node("im_a_shape")
c.Node("im a shape")
c.Node("i'm a shape")
c.Node("a-shape")
fmt.Println(c.d2())
Output:

imAShape
im_a_shape
im a shape
i'm a shape
a-shape
Example (Is3d)
c := Ctx()
c.Node("x").Is3d()
c.Scon("x", "y").Label("hi")
fmt.Println(c.d2())
Output:

x: {style.3d: true}
x -> y: hi
Example (Json)
c := Ctx()
json := `[13, {"37": 37}]`
c.Json(json)
fmt.Println(c.d2())
Output:

direction: right
0: {
  shape: sql_table
  13: " "
}
1: {
  shape: sql_table
  37: 37
}
0.1 -> 1
Example (Label)
c := Ctx()
c.Node("pg").Label("PostgreSQL")
c.Node("Cloud").Label("my cloud")
fmt.Println(c.d2())
Output:

pg: PostgreSQL
Cloud: my cloud
Example (Multiple)
c := Ctx()
c.Node("x").Multiple()
c.Scon("x", "y").Label("hi")
fmt.Println(c.d2())
Output:

x: {style.multiple: true}
x -> y: hi
Example (Nested_containers)
c := Ctx()
c.Node("clouds").
	Children(
		c.Node("aws").Cons(
			c.Con("load_balancer", "api"),
			c.Con("api", "db"),
		),
		c.Node("gcloud").Cons(
			c.Con("auth", "db"),
		),
	).
	Cons(
		c.Con("gcloud", "aws"),
	)
fmt.Println(c.d2())
Output:

clouds: {
  aws: {
    load_balancer <-> api
    api <-> db
  }
  gcloud: {
    auth <-> db
  }
  gcloud <-> aws
}
Example (Node_json)
json := `{
		"fruit":"Apple"
	 }`

c := Ctx()
c.Node("ttt").Json(json)

fmt.Println(c.d2())
Output:

ttt: {
  0: {
    shape: sql_table
    fruit: Apple
  }
}
Example (Opacity)
c := Ctx()
c.Direction(c.Right())
c.Node("x").Opacity(0)
c.Node("y").Opacity(0.7)
c.Scon("x", "y").Opacity(0.4)
fmt.Println(c.d2())
Output:

direction: right
x: {style.opacity: 0.0}
y: {style.opacity: 0.7}
x -> y: {style.opacity: 0.4}
Example (Same_name_sub_containers)
c := Ctx()
c.Node("christmas").Fill("#ACE1AF")
c.Con("christmas.presents", "birthdays.presents").Label("regift")
fmt.Println(c.d2())
Output:

christmas: {style.fill: "#ACE1AF"}
christmas.presents <-> birthdays.presents: regift
Example (Sequence)
c := Ctx()
c.Sequence()
c.Scon("alice", "bob").Label("What does it mean\nto be well-adjusted?")
c.Scon("bob", "alice").Label("The ability to play bridge or\ngolf as if they were games.")
fmt.Println(c.d2())
Output:

shape: sequence_diagram
alice -> bob: "What does it mean\nto be well-adjusted?"
bob -> alice: "The ability to play bridge or\ngolf as if they were games."
Example (Shadow)
c := Ctx()
c.Node("x").Shadow()
c.Scon("x", "y").Label("hi")
fmt.Println(c.d2())
Output:

x: {style.shadow: true}
x -> y: hi
Example (Shape)
c := Ctx()
c.Cloud("cloud")
fmt.Println(c.d2())
Output:

cloud: {shape: cloud}
Example (Sql_table)
c := Ctx()
c.SqlTable("table").
	Field("id", "int", "primary_key").
	Field("last_updated", "timestamp with time zone")
fmt.Println(c.d2())
Output:

table: {
  shape: sql_table
  id: int
  id.constraint: primary_key
  last_updated: timestamp with time zone
}
Example (StrokeDash)
c := Ctx()
c.Node("x").StrokeDash(5)
c.Scon("x", "y").Label("hi").StrokeDash(3)
fmt.Println(c.d2())
Output:

x: {style.stroke-dash: 5}
x -> y: hi {style.stroke-dash: 3}
Example (StrokeWidth)
c := Ctx()
c.Direction(c.Right())
c.Node("x").StrokeWidth(1)
c.Scon("x", "y").StrokeWidth(8)
fmt.Println(c.d2())
Output:

direction: right
x: {style.stroke-width: 1}
x -> y: {style.stroke-width: 8}
Example (Tooltip)
c := Ctx()
c.Node("x").Tooltip("Hello,\nWorld!")
fmt.Println(c.d2())
Output:

x: {tooltip: "Hello,\nWorld!"}

Index

Examples

Constants

View Source
const GopPackage = true

Variables

This section is empty.

Functions

func Gopt_App_Main

func Gopt_App_Main(app IMain, workers ...IWorker)

Types

type App

type App = Mgr

type Cdor

type Cdor struct {
	// contains filtered or unexported fields
}

func Ctx

func Ctx() *Cdor

func (*Cdor) ApplyConfig added in v0.0.5

func (c *Cdor) ApplyConfig(cfg *config) *Cdor

ApplyConfig applys the diagram's config

func (*Cdor) ApplyOption added in v0.0.5

func (c *Cdor) ApplyOption(opt *option) *Cdor

ApplyOption applys the diagram's global option

func (*Cdor) Aubergine added in v0.1.1

func (c *Cdor) Aubergine() int

func (*Cdor) ButteredToast added in v0.1.1

func (c *Cdor) ButteredToast() int

func (*Cdor) Callout added in v0.1.1

func (c *Cdor) Callout(id string) *node

Callout creates a callout node

func (Cdor) Center added in v0.0.3

func (c Cdor) Center(b ...bool) *config

Center sets if the diagram is centered

func (*Cdor) Cfg

func (c *Cdor) Cfg() *config

Cfg creates a default config

func (*Cdor) Circle added in v0.1.1

func (c *Cdor) Circle(id string) *node

Circle creates a circle node

func (*Cdor) Class added in v0.1.2

func (c *Cdor) Class(id string) *node

Class creates a uml class node

func (*Cdor) Clear added in v0.0.3

func (c *Cdor) Clear()

Clear clears the diagram

func (*Cdor) Cloud added in v0.1.1

func (c *Cdor) Cloud(id string) *node

Cloud creates a cloud node

func (*Cdor) Code added in v0.1.2

func (c *Cdor) Code(id, tag, code string) *node

Code creates a code node

func (*Cdor) ColorblindClear added in v0.1.1

func (c *Cdor) ColorblindClear() int

func (*Cdor) Con

func (c *Cdor) Con(src, dst string) *connection

Con creats a connection

func (*Cdor) ConOpt added in v0.0.5

func (c *Cdor) ConOpt() *conOption

ConOpt creates a default connection option

func (*Cdor) Cool added in v0.1.1

func (c *Cdor) Cool() int

func (*Cdor) Cylinder added in v0.1.1

func (c *Cdor) Cylinder(id string) *node

Cylinder creates a cylinder node

func (*Cdor) D2 added in v0.1.2

func (c *Cdor) D2(d2script string) *Cdor

D2 append d2 script as part of the diagram

func (*Cdor) DarkFlagshipTerrastruct added in v0.1.1

func (c *Cdor) DarkFlagshipTerrastruct() int

func (*Cdor) DarkMauve added in v0.1.1

func (c *Cdor) DarkMauve() int

func (Cdor) DarkTheme added in v0.0.3

func (c Cdor) DarkTheme(theme int) *config

DarkTheme sets the diagram's dark theme id

func (Cdor) DarkThemeOverrides added in v0.0.3

func (c Cdor) DarkThemeOverrides(ov *ThemeOverrides) *config

DarkThemeOverrides sets the diagram's dark theme over rides

func (*Cdor) Diamond added in v0.1.1

func (c *Cdor) Diamond(id string) *node

Diamond creates a diamond node

func (Cdor) Direction added in v0.0.3

func (c Cdor) Direction(dir string) *config

Direction sets the diagram's direction

func (*Cdor) Document added in v0.1.1

func (c *Cdor) Document(id string) *node

Document creates a document node

func (*Cdor) Dots added in v0.1.2

func (c *Cdor) Dots() string

func (*Cdor) Down added in v0.1.1

func (c *Cdor) Down() string

func (*Cdor) EarthTones added in v0.1.1

func (c *Cdor) EarthTones() int

func (Cdor) ElkLayout added in v0.0.3

func (c Cdor) ElkLayout(b ...bool) *config

ElkLayout sets if the diagram is elk layouted

func (*Cdor) EvergladeGreen added in v0.1.1

func (c *Cdor) EvergladeGreen() int

func (*Cdor) FillPattern added in v0.1.0

func (c *Cdor) FillPattern(pattern string) *Cdor

FillPattern sets the global fill pattern

func (*Cdor) Flagship added in v0.1.1

func (c *Cdor) Flagship() int

func (*Cdor) Gen

func (c *Cdor) Gen() (svg []byte, err error)

Gen generates svg data for the diagram

func (*Cdor) Grain added in v0.1.2

func (c *Cdor) Grain() string

func (*Cdor) GrapeSoda added in v0.1.1

func (c *Cdor) GrapeSoda() int

func (*Cdor) GridCols added in v0.0.7

func (c *Cdor) GridCols(cols int) *Cdor

GridCols sets the global grid columns

func (*Cdor) GridGap added in v0.0.7

func (c *Cdor) GridGap(gap int) *Cdor

GridGap sets the global grid gap

func (*Cdor) GridRows added in v0.0.7

func (c *Cdor) GridRows(rows int) *Cdor

GridRows sets the global grid rows

func (*Cdor) HeadArrow added in v0.1.2

func (c *Cdor) HeadArrow() string

func (*Cdor) HeadCfMany added in v0.1.2

func (c *Cdor) HeadCfMany() string

func (*Cdor) HeadCfManyRequired added in v0.1.2

func (c *Cdor) HeadCfManyRequired() string

func (*Cdor) HeadCfOne added in v0.1.2

func (c *Cdor) HeadCfOne() string

func (*Cdor) HeadCfOneRequired added in v0.1.2

func (c *Cdor) HeadCfOneRequired() string

func (*Cdor) HeadDiamond added in v0.1.2

func (c *Cdor) HeadDiamond() string

func (*Cdor) HeadNone added in v0.1.2

func (c *Cdor) HeadNone() string

func (*Cdor) HeadTriangle added in v0.1.2

func (c *Cdor) HeadTriangle() string

func (*Cdor) Hexagon added in v0.1.1

func (c *Cdor) Hexagon(id string) *node

Hexagon creates a hexagon node

func (*Cdor) HorizontalGap added in v0.0.7

func (c *Cdor) HorizontalGap(gap int) *Cdor

HorizontalGap sets the global horizontal gap

func (*Cdor) Image added in v0.1.2

func (c *Cdor) Image(id string) *node

Image creates an image node

func (*Cdor) Json added in v0.0.5

func (c *Cdor) Json(json string) *Cdor

Json creates nodes and connections for a json

func (*Cdor) Jsonn added in v0.1.2

func (c *Cdor) Jsonn(id, json string) *node

Jsonn creates a node with id id and children with json

func (*Cdor) Latex added in v0.1.2

func (c *Cdor) Latex(id, content string) *node

Latex creates a latex node

func (*Cdor) Left added in v0.1.1

func (c *Cdor) Left() string

func (*Cdor) Lines added in v0.1.2

func (c *Cdor) Lines() string

func (*Cdor) Markdown added in v0.1.2

func (c *Cdor) Markdown(id, content string) *node

Markdown creates a markdown node

func (*Cdor) MdCode added in v0.0.4

func (c *Cdor) MdCode(code string, id ...string) *node

MdCode creates a node with md code style

func (*Cdor) MixedBerryBlue added in v0.1.1

func (c *Cdor) MixedBerryBlue() int

func (*Cdor) Neutral added in v0.1.1

func (c *Cdor) Neutral() int

func (*Cdor) NeutralGrey added in v0.1.1

func (c *Cdor) NeutralGrey() int

func (*Cdor) Node

func (c *Cdor) Node(id string) *node

Node creats a node with default shape rectangle

func (*Cdor) Obj added in v0.0.5

func (c *Cdor) Obj(x any) *Cdor

Obj creates nodes and connections for an object

func (*Cdor) Objn added in v0.1.2

func (c *Cdor) Objn(id string, obj any) *node

Objn creates a node with id id and children with obj

func (*Cdor) Opt

func (c *Cdor) Opt() *option

Opt creates a default option

func (*Cdor) OrangeCreamsicle added in v0.1.1

func (c *Cdor) OrangeCreamsicle() int

func (*Cdor) Origami added in v0.1.1

func (c *Cdor) Origami() int

func (*Cdor) Oval added in v0.1.1

func (c *Cdor) Oval(id string) *node

Oval creates a oval node

func (Cdor) Pad added in v0.0.3

func (c Cdor) Pad(pad int) *config

Pad sets the diagram's pad

func (*Cdor) Page added in v0.1.1

func (c *Cdor) Page(id string) *node

Page creates a page node

func (*Cdor) Parallelogram added in v0.1.1

func (c *Cdor) Parallelogram(id string) *node

Parallelogram creates a parallelogram node

func (*Cdor) Person added in v0.1.1

func (c *Cdor) Person(id string) *node

Person creates a person node

func (*Cdor) Pkg added in v0.1.1

func (c *Cdor) Pkg(id string) *node

Pkg creates a package node

func (*Cdor) Queue added in v0.1.1

func (c *Cdor) Queue(id string) *node

Queue creates a queue node

func (*Cdor) Rectangle added in v0.1.1

func (c *Cdor) Rectangle(id string) *node

Rectangle creates a rectangle node

func (*Cdor) Right added in v0.1.1

func (c *Cdor) Right() string

func (*Cdor) SaveFile added in v0.0.3

func (c *Cdor) SaveFile(filename string) error

SaveFile saves the svg data to filename

func (*Cdor) Scon added in v0.0.4

func (c *Cdor) Scon(src, dst string) *connection

Scon creats a single connection

func (Cdor) Sequence added in v0.0.4

func (c Cdor) Sequence() *config

Sequence sets the diagram as a sequence

func (*Cdor) Sequencen added in v0.1.2

func (c *Cdor) Sequencen(id string) *node

Sequencen creates a node with a sequence shape

func (*Cdor) ShirleyTemple added in v0.1.1

func (c *Cdor) ShirleyTemple() int

func (Cdor) Sketch added in v0.0.3

func (c Cdor) Sketch(b ...bool) *config

Sketch sets if the diagram is sketch style

func (*Cdor) SqlTable added in v0.1.2

func (c *Cdor) SqlTable(id string) *node

SqlTable creates a sql_table node

func (*Cdor) Square added in v0.1.1

func (c *Cdor) Square(id string) *node

Square creates a square node

func (*Cdor) Step added in v0.1.1

func (c *Cdor) Step(id string) *node

Step creates a step node

func (*Cdor) StoredData added in v0.1.1

func (c *Cdor) StoredData(id string) *node

StoredData creates a stored_data node

func (*Cdor) Terminal added in v0.1.1

func (c *Cdor) Terminal() int

func (*Cdor) TerminalGrayscale added in v0.1.1

func (c *Cdor) TerminalGrayscale() int

func (*Cdor) Text added in v0.1.2

func (c *Cdor) Text(id, content string) *node

Text creates a text node

func (Cdor) Theme added in v0.0.3

func (c Cdor) Theme(theme int) *config

Theme sets the diagram's theme id

func (Cdor) ThemeOverrides added in v0.0.3

func (c Cdor) ThemeOverrides(ov *ThemeOverrides) *config

ThemeOverrides sets the diagram's theme over rides

func (*Cdor) Toml added in v0.0.5

func (c *Cdor) Toml(toml string) *Cdor

Toml creates nodes and connections for a toml

func (*Cdor) Tomln added in v0.1.2

func (c *Cdor) Tomln(id, toml string) *node

Tomln creates a node with id id and children with toml

func (*Cdor) Up added in v0.1.1

func (c *Cdor) Up() string

func (*Cdor) VanillaNitroCola added in v0.1.1

func (c *Cdor) VanillaNitroCola() int

func (*Cdor) VerticalGap added in v0.0.7

func (c *Cdor) VerticalGap(gap int) *Cdor

VertivalGap sets the global vertical gap

func (*Cdor) Yaml added in v0.0.5

func (c *Cdor) Yaml(yaml string) *Cdor

Yaml creates nodes and connections for a yaml

func (*Cdor) Yamln added in v0.1.2

func (c *Cdor) Yamln(id, yaml string) *node

Yamln creats a node with id id and children with yaml

type IMain added in v0.0.5

type IMain interface {
	// contains filtered or unexported methods
}

type IWorker added in v0.0.4

type IWorker interface {
	// contains filtered or unexported methods
}

type Mgr added in v0.1.0

type Mgr struct {
	Cdor
	// contains filtered or unexported fields
}

func (*Mgr) ApplyConfig added in v0.1.0

func (a *Mgr) ApplyConfig(cfg *config, diagrams ...string)

func (*Mgr) ApplyOption added in v0.1.0

func (a *Mgr) ApplyOption(opt *option, diagrams ...string)

func (Mgr) Center added in v0.1.0

func (c Mgr) Center(b ...bool) *config

Center sets if the diagram is centered

func (Mgr) DarkTheme added in v0.1.0

func (c Mgr) DarkTheme(theme int) *config

DarkTheme sets the diagram's dark theme id

func (Mgr) DarkThemeOverrides added in v0.1.0

func (c Mgr) DarkThemeOverrides(ov *ThemeOverrides) *config

DarkThemeOverrides sets the diagram's dark theme over rides

func (Mgr) Direction added in v0.1.0

func (c Mgr) Direction(dir string) *config

Direction sets the diagram's direction

func (Mgr) ElkLayout added in v0.1.0

func (c Mgr) ElkLayout(b ...bool) *config

ElkLayout sets if the diagram is elk layouted

func (*Mgr) Merge added in v0.1.0

func (a *Mgr) Merge(diagrams ...string) *Cdor

func (Mgr) Pad added in v0.1.0

func (c Mgr) Pad(pad int) *config

Pad sets the diagram's pad

func (*Mgr) RangeCdors added in v0.1.0

func (m *Mgr) RangeCdors(action func(string, *Cdor, error) error, diagrams ...string)

func (*Mgr) SaveFiles added in v0.1.0

func (a *Mgr) SaveFiles(dir string, diagrams ...string) (err error)

func (Mgr) Sequence added in v0.1.0

func (c Mgr) Sequence() *config

Sequence sets the diagram as a sequence

func (Mgr) Sketch added in v0.1.0

func (c Mgr) Sketch(b ...bool) *config

Sketch sets if the diagram is sketch style

func (Mgr) Theme added in v0.1.0

func (c Mgr) Theme(theme int) *config

Theme sets the diagram's theme id

func (Mgr) ThemeOverrides added in v0.1.0

func (c Mgr) ThemeOverrides(ov *ThemeOverrides) *config

ThemeOverrides sets the diagram's theme over rides

type ThemeOverrides added in v0.0.3

type ThemeOverrides = d2target.ThemeOverrides

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL