style.colorNodesByProperty
colorNodesByProperty(property: string, options?: ColorMappingOptions): Promise<void>Assign colors to nodes based on the values of a property.
In "ordinal" mode (default), each unique value gets a distinct palette
color unless colorMap explicitly maps it. In "sequential" mode, the
numeric value is linearly interpolated between colorFrom and colorTo.
All SetNodeColor commands are wrapped in a single labeled transaction —
one undo step. Emits "style:changed".
property | string | Name of the node property to use for color mapping. |
options | ColorMappingOptions | Mapping mode, explicit color map, color range, and optional category filter. |
Returns: Promise<void>
Example
await api.style.colorNodesByProperty("status", { mode: "ordinal" });
await api.style.colorNodesByProperty("score", { mode: "sequential", colorFrom: "#0000ff", colorTo: "#ff0000" });