Documentation
¶
Overview ¶
d2themes defines themes to make d2 diagrams pretty Color codes: darkest (N1) -> lightest (N7)
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CoolNeutral = Neutral{
N1: "#0A0F25",
N2: "#676C7E",
N3: "#9499AB",
N4: "#CFD2DD",
N5: "#DEE1EB",
N6: "#EEF1F8",
N7: "#FFFFFF",
}
View Source
var DarkMauveNeutral = Neutral{
N1: "#CDD6F4",
N2: "#BAC2DE",
N3: "#A6ADC8",
N4: "#585B70",
N5: "#45475A",
N6: "#313244",
N7: "#1E1E2E",
}
View Source
var DarkNeutral = Neutral{
N1: "#F4F6FA",
N2: "#BBBEC9",
N3: "#868A96",
N4: "#676D7D",
N5: "#3A3D49",
N6: "#191C28",
N7: "#000410",
}
View Source
var WarmNeutral = Neutral{
N1: "#170206",
N2: "#535152",
N3: "#787777",
N4: "#CCCACA",
N5: "#DFDCDC",
N6: "#ECEBEB",
N7: "#FFFFFF",
}
Functions ¶
func ResolveThemeColor ¶ added in v0.2.2
func ShapeTheme ¶ added in v0.2.1
Types ¶
type ColorPalette ¶
type ColorPalette struct {
Neutrals Neutral `json:"neutrals"`
// Base Colors: used for containers
B1 string `json:"b1"`
B2 string `json:"b2"`
B3 string `json:"b3"`
B4 string `json:"b4"`
B5 string `json:"b5"`
B6 string `json:"b6"`
// Alternative colors A
AA2 string `json:"aa2"`
AA4 string `json:"aa4"`
AA5 string `json:"aa5"`
// Alternative colors B
AB4 string `json:"ab4"`
AB5 string `json:"ab5"`
}
type PatternOverlay ¶ added in v0.2.5
type PatternOverlay struct {
// contains filtered or unexported fields
}
func NewPatternOverlay ¶ added in v0.2.5
func NewPatternOverlay(el *ThemableElement, pattern string) *PatternOverlay
func (*PatternOverlay) Render ¶ added in v0.2.5
func (o *PatternOverlay) Render() (string, error)
type SpecialRules ¶ added in v0.2.5
type ThemableElement ¶ added in v0.2.1
type ThemableElement struct {
X float64
X1 float64
X2 float64
Y float64
Y1 float64
Y2 float64
Width float64
Height float64
R float64
Rx float64
Ry float64
Cx float64
Cy float64
D string
Mask string
Points string
Transform string
Href string
Xmlns string
Fill string
Stroke string
StrokeDashArray string
BackgroundColor string
Color string
ClassName string
Style string
Attributes string
Content string
ClipPath string
FillPattern string
// contains filtered or unexported fields
}
ThemableElement is a helper class for creating new XML elements. This should be preferred over formatting and must be used whenever Fill, Stroke, BackgroundColor or Color contains a color from a theme. i.e. N[1-7] | B[1-6] | AA[245] | AB[45]
func NewThemableElement ¶ added in v0.2.1
func NewThemableElement(tag string) *ThemableElement
func (*ThemableElement) Copy ¶ added in v0.2.2
func (el *ThemableElement) Copy() *ThemableElement
func (*ThemableElement) Render ¶ added in v0.2.1
func (el *ThemableElement) Render() string
func (*ThemableElement) SetMaskUrl ¶ added in v0.2.1
func (el *ThemableElement) SetMaskUrl(url string)
func (*ThemableElement) SetTranslate ¶ added in v0.2.1
func (el *ThemableElement) SetTranslate(x, y float64)
type ThemableSketchOverlay ¶ added in v0.2.1
type ThemableSketchOverlay struct {
// contains filtered or unexported fields
}
func NewThemableSketchOverlay ¶ added in v0.2.1
func NewThemableSketchOverlay(el *ThemableElement, fill string) *ThemableSketchOverlay
func (*ThemableSketchOverlay) Render ¶ added in v0.2.1
func (o *ThemableSketchOverlay) Render() (string, error)
TODO we can just call el.Copy() to prevent that WARNING: Do not reuse the element afterwards as this function changes the Class property
type Theme ¶
type Theme struct {
ID int64 `json:"id"`
Name string `json:"name"`
Colors ColorPalette `json:"colors"`
SpecialRules SpecialRules `json:"specialRules,omitempty"`
}
func (*Theme) ApplyOverrides ¶ added in v0.6.3
func (t *Theme) ApplyOverrides(overrides *d2target.ThemeOverrides)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.