Skip to content

Style and theme ​

Preview version

The jsMind V2 programming API is currently a preview. The API will change in later updates. Please check this documentation anytime for the interface that is current.

Visual overrides on a map, a node, or an edge. Unset fields fall back to the theme.

This page is generated from the published typings dist/jsmind.d.ts with TypeDoc.

JmNodeStyle ​

Interface

Visual overrides for a single node.

Remarks

Every field is optional and unset fields fall back to the theme. The node carries only what differs from the theme, so a theme change still reaches every node that did not explicitly override anything.

incoming lives on the child node: a line connects exactly one child, which makes the child the natural owner. The name mirrors the layout layer (calculateNodeIncomingPoint / calculateNodeOutgoingPoint).

Properties

NameTypeDescription
background (optional)stringBackground color, e.g. #ffffff.
borderColor (optional)stringBorder color.
borderStyle (optional)JmLinePatternBorder dash style.
borderWidth (optional)numberBorder width in pixels.
color (optional)stringText color.
fontSize (optional)numberFont size in pixels.
fontWeight (optional)JmFontWeightFont weight.
incoming (optional)JmLineStyleStyle of the line connecting this node to its parent.
tone (optional)JmToneSemantic tone for this node. Overrides background/border/color from the theme.

JmLineStyle ​

Interface

Visual style of a single line.

Remarks

Shared by two places: JmNodeStyle.incoming (the line connecting a node to its parent) and JmEdge.style (lines for additional, non-hierarchical relationships). One shape avoids two vocabularies for the same thing.

Properties

NameTypeDescription
color (optional)stringLine color, e.g. #4a9eff.
curve (optional)JmLineCurveHow the line travels between its endpoints. Defaults to bezier.
pattern (optional)JmLinePatternLine pattern.
width (optional)numberLine width in pixels.

JmStyle ​

Interface

Style declaration for a whole mind map, as stored in the data file.

Remarks

Named in the singular, like the per-node and per-edge style fields: one style concept, with the scope decided by where it sits. mind.style covers the whole map; node.style covers one node; edge.style covers one edge. Carrying both styles and style in one document only differed by an s, which is a trap for an agent generating the JSON.

Read this as: "this mind map looks like this — it inherits from theme, then overrides the fields listed below."

Splitting inheritance from overrides into one flat declaration avoids the ambiguity of a nested { name, ...overrides } form, where name could be read either as "what this theme is called" or as "which theme to inherit". Here theme can only mean the latter.

  • theme names a built-in preset to inherit from. Omitted means "default", so a file that only overrides a few colors does not have to name it.
  • defaultTone names the tone every node without one of its own wears. It is a name rather than a palette so this declaration stays an inheritance decision: restyle the tone once in tones and the whole map follows.
  • Every other field is an override applied on top of that preset, merged deeply.

Properties

NameTypeDescription
background (optional)stringCanvas background color.
defaultTone (optional)stringTone used by nodes that state none of their own.
expander (optional)Partial<JmThemeExpander>Expander geometry overrides.
line (optional)Partial<JmThemeLine>Line geometry overrides.
node (optional)JmThemeNodeOverrideNode geometry overrides.
theme (optional)stringName of the built-in theme to inherit from. Defaults to "default".
tones (optional)Partial<Record<JmTone, Partial<JmTonePalette>>>Per-tone color overrides.

JmThemeNode ​

Interface

Geometry and typography shared by every node.

Properties

NameTypeDescription
borderWidthnumberDefault border width in pixels.
fontFamilystringFont family.
fontSizenumberBase font size in pixels.
lineHeightnumberLine height as a multiple of the font size.
maxWidthnumberMaximum node width in pixels before text wraps.
paddingnumberInner padding in pixels.
radiusnumberCorner radius in pixels.
rootFontSizenumberRoot node font size in pixels.
shadowJmThemeShadowDrop shadows for the idle, hover and selected states.

JmThemeLine ​

Interface

Geometry shared by every line of a mind map.

Properties

NameTypeDescription
curveJmLineCurveDefault curve shape. Named curve to match JmLineStyle.curve.
patternJmLinePatternDefault line pattern. Named pattern to match JmLineStyle.pattern.
widthnumberDefault line width in pixels.

JmThemeExpander ​

Interface

Geometry of the collapse/expand control.

Properties

NameTypeDescription
borderWidthnumberBorder width in pixels.
fontSizenumberFont size of the character or count drawn inside, in pixels.
lineHeightnumberLine height of that content, in pixels.
radiusnumberCorner radius in pixels.
sizenumberExpander width and height in pixels.

JmThemeShadow ​

Interface

Drop shadows for the three visual states a node can be in.

Remarks

States live in the theme rather than in CSS because they change the node's appearance, and "how does this node look" belongs with the rest of the appearance. normal is the resting state; hover and selected are what the pointer and the selection do to it.

Properties

NameTypeDescription
hoverJmThemeShadowLayerShadow while the pointer is over the node.
normalJmThemeShadowLayerShadow when the node is idle.
selectedJmThemeShadowLayerShadow when the node is selected.

JmThemeShadowLayer ​

Interface

One drop shadow, in CSS terms.

Remarks

Spelled out as four numbers and a color rather than kept as a CSS string like "1px 1px 1px #666" so it can be merged field by field — an override that changes only the blur should not have to restate the offsets — and so an agent writing the JSON never has to get CSS shorthand syntax right.

Properties

NameTypeDescription
blurnumberBlur radius in pixels.
colorstringShadow color, e.g. #666666.
offsetXnumberHorizontal offset in pixels.
offsetYnumberVertical offset in pixels.

JmThemeShadowOverride ​

Interface

A partial replacement for JmThemeShadow.

Remarks

Every level is optional so a style can restyle one state, or one field of one state (hover.blur), without restating the rest. The merged result is always complete.

Properties

NameTypeDescription
hover (optional)Partial<JmThemeShadowLayer>Override for the hover shadow.
normal (optional)Partial<JmThemeShadowLayer>Override for the idle shadow.
selected (optional)Partial<JmThemeShadowLayer>Override for the selected shadow.

JmThemeNodeOverride ​

Type

Partial overrides for JmThemeNode.

Remarks

Identical to Partial<JmThemeNode> except for shadow, which allows overriding a single state rather than all three.

JmTonePalette ​

Interface

Colors a tone resolves to.

Remarks

line is the color of the connecting line, which usually differs from border so that a subtree reads as one visual grouping.

Properties

NameTypeDescription
borderColorstringNode border color.
fillColorstringNode background color.
lineColorstringConnecting line color.
textColorstringNode text color.

JmTone ​

Enumeration

Semantic tone. Expresses color only, never geometry.

Remarks

Semantic roles are about color; geometry is orthogonal (a node can be warning-colored, thick-bordered and large-font at once). Keeping them apart gives the agent fewer side effects per change, which makes generated output more controllable.

Members

NameValueDescription
Accent"accent"Accent tone for an element that stands out without carrying a judgement.
Danger"danger"Danger or negative tone.
Default"default"Default tone, resolved from the theme's neutral palette.
Info"info"Informational or neutral-accent tone.
Primary"primary"Primary or emphasis tone.
Success"success"Success or positive tone.
Warning"warning"Warning or caution tone.

JmFontWeight ​

Enumeration

Font weight.

Remarks

An enum rather than an inline union so the CLI can enumerate the accepted values instead of repeating them. JmLinePattern and JmLineCurve had this shape already; fontWeight was the odd one out.

Members

NameValueDescription
Bold"bold"Emphasised weight.
Normal"normal"Regular weight.

JmLinePattern ​

Enumeration

Line dash style.

Members

NameValueDescription
Dashed"dashed"Dashed line.
Dotted"dotted"Dotted line.
Solid"solid"Continuous line.

JmLineCurve ​

Enumeration

How a line travels between its two endpoints.

Remarks

A different axis from JmLinePattern: pattern says whether the stroke is dashed, curve says what shape it traces. They are separable on purpose - a straight dashed line and a curved dashed line both need to exist, and a single style string (as in v1's line_style) could only ever express one of the two.

Members

NameValueDescription
Bezier"bezier"Cubic bezier leaving each endpoint horizontally.
Straight"straight"Straight segment from one endpoint to the other.

本文档由 AI 协助生成 / This documentation was prepared with AI assistance