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 other than incoming 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).

incoming itself is required even when it overrides nothing: a node always has a parent line, so node.style.incoming.color = ... is a write that needs no existence check. An empty incoming means "inherit the theme", exactly like an absent one did before.

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.
incomingJmLineStyleStyle of the line connecting this node to its parent. Always present on a node - an empty object means "the theme decides". Required so a caller can write node.style.incoming.color without asking whether the line block exists.
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. Named pattern rather than style because this type is itself reached through node.style.incoming, and .style.style reads badly. pattern also covers solid honestly — solid is not a dash.
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. Since: 2.1.0 A tone name, not a palette snapshot. Storing resolved colors here would freeze them: a later tones override, or a different preset, would no longer reach the nodes that rely on this field. A name is resolved through the same palette lookup a node-level tone uses, so style.tones keeps working on top of it.
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. Unitless multiplier, matching the CSS line-height: 1.125 form, so it scales with fontSize instead of needing a matching pixel value per size.
maxWidthnumberMaximum node width in pixels before text wraps. Wrapping is a layout input, not a detail: it decides how tall a node is, which decides where its children go.
paddingnumberInner padding in pixels.
radiusnumberCorner radius in pixels.
rootFontSizenumberRoot node font size in pixels. Separate from fontSize because the root is the one node that reads as a title: v1 rendered it at 24px against a 16px body. Folding it into fontSize would have forced every theme to pick one and lose the hierarchy.
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. size / 2 gives a circle, which is what the stylesheet did with border-radius: 50%. A number keeps it in the same units as every other length here; percentage radii only make sense when the box can grow.
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. Every field here carries a Color suffix. The palette sits alongside JmNodeStyle, which already uses borderColor, so borderColor means the same thing in both places and an agent reading the JSON never has to guess whether fill or border is a color or a length.
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. primary already means "this is the important one", which is a claim about the content. accent is the option for "make this one visually distinct" with no claim attached — the purple that v1 exposed as theme-wisteria and that none of the semantic tones could absorb.
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. The default, and what v1 drew. Edges leaving a node always read better when they depart along the horizontal axis: siblings sit in a column, so a straight segment between two of them cuts diagonally across the layout.
Straight"straight"Straight segment from one endpoint to the other.

This documentation was prepared with AI assistance