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
| Name | Type | Description |
|---|---|---|
background (optional) | string | Background color, e.g. #ffffff. |
borderColor (optional) | string | Border color. |
borderStyle (optional) | JmLinePattern | Border dash style. |
borderWidth (optional) | number | Border width in pixels. |
color (optional) | string | Text color. |
fontSize (optional) | number | Font size in pixels. |
fontWeight (optional) | JmFontWeight | Font weight. |
incoming | JmLineStyle | Style 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) | JmTone | Semantic 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
| Name | Type | Description |
|---|---|---|
color (optional) | string | Line color, e.g. #4a9eff. |
curve (optional) | JmLineCurve | How the line travels between its endpoints. Defaults to bezier. |
pattern (optional) | JmLinePattern | Line 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) | number | Line 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.
themenames 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.defaultTonenames 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 intonesand the whole map follows.- Every other field is an override applied on top of that preset, merged deeply.
Properties
| Name | Type | Description |
|---|---|---|
background (optional) | string | Canvas background color. |
defaultTone (optional) | string | Tone 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) | JmThemeNodeOverride | Node geometry overrides. |
theme (optional) | string | Name 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
| Name | Type | Description |
|---|---|---|
borderWidth | number | Default border width in pixels. |
fontFamily | string | Font family. |
fontSize | number | Base font size in pixels. |
lineHeight | number | Line 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. |
maxWidth | number | Maximum 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. |
padding | number | Inner padding in pixels. |
radius | number | Corner radius in pixels. |
rootFontSize | number | Root 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. |
shadow | JmThemeShadow | Drop shadows for the idle, hover and selected states. |
JmThemeLine
Interface
Geometry shared by every line of a mind map.
Properties
| Name | Type | Description |
|---|---|---|
curve | JmLineCurve | Default curve shape. Named curve to match JmLineStyle.curve. |
pattern | JmLinePattern | Default line pattern. Named pattern to match JmLineStyle.pattern. |
width | number | Default line width in pixels. |
JmThemeExpander
Interface
Geometry of the collapse/expand control.
Properties
| Name | Type | Description |
|---|---|---|
borderWidth | number | Border width in pixels. |
fontSize | number | Font size of the character or count drawn inside, in pixels. |
lineHeight | number | Line height of that content, in pixels. |
radius | number | Corner 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. |
size | number | Expander 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
| Name | Type | Description |
|---|---|---|
hover | JmThemeShadowLayer | Shadow while the pointer is over the node. |
normal | JmThemeShadowLayer | Shadow when the node is idle. |
selected | JmThemeShadowLayer | Shadow 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
| Name | Type | Description |
|---|---|---|
blur | number | Blur radius in pixels. |
color | string | Shadow color, e.g. #666666. |
offsetX | number | Horizontal offset in pixels. |
offsetY | number | Vertical 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
| Name | Type | Description |
|---|---|---|
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
| Name | Type | Description |
|---|---|---|
borderColor | string | Node border color. |
fillColor | string | Node 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. |
lineColor | string | Connecting line color. |
textColor | string | Node 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
| Name | Value | Description |
|---|---|---|
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
| Name | Value | Description |
|---|---|---|
Bold | "bold" | Emphasised weight. |
Normal | "normal" | Regular weight. |
JmLinePattern
Enumeration
Line dash style.
Members
| Name | Value | Description |
|---|---|---|
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
| Name | Value | Description |
|---|---|---|
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. |