Style
A saved collection of visual display settings — edge style, face colors, background, watermarks, and more.
Styles appear in the Styles panel and can be assigned to
scenes. Retrieve all styles with model.getStyles(), or get
the active one with model.getSelectedStyle(). To modify a
style’s rendering options, use op.styleUpdateRenderingOptions()
inside a performOperation.
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();
// Read the active stylelet selected = await model.getSelectedStyle();let currentStyle = selected.style;console.log(currentStyle.name);// => '[Architectural Design Style]'
// Duplicate it, tweak it, and make it activeawait model.performOperation(async op => { const newRef = op.createDuplicateStyle(currentStyle); op.styleSetName(newRef, 'Night Mode'); op.styleUpdateRenderingOptions(newRef, { SkyColor: '#001133', }); op.setSelectedStyle(newRef);}, 'Create Night Mode style');SDK 2.26.0 Protocol 1.23.0
Properties
Section titled “Properties”attributes
Section titled “attributes”
readonlyattributes:Attributes
User-defined key-value data attached to this style.
description
Section titled “description”
readonlydescription:string
A text description of this style.
fileName
Section titled “fileName”
readonlyfileName:string
The file name of this style on disk.
readonlyid:number
The persistent numeric identifier for this style, stable across sessions.
readonlyname:string
The display name of this style, like
'[Architectural Design Style]'.
readonlytype:Style=EntityType.Style
Accessors
Section titled “Accessors”sketchupId
Section titled “sketchupId”Get Signature
Section titled “Get Signature”get sketchupId():
SketchupId
JS API identifier for this style. Pass it to API methods that accept a sketchupId.
Returns
Section titled “Returns”typeName
Section titled “typeName”Get Signature
Section titled “Get Signature”get typeName():
string
Returns a named variant of the type field.
SDK 2.35.0
Returns
Section titled “Returns”string
Methods
Section titled “Methods”getRenderingOptions()
Section titled “getRenderingOptions()”getRenderingOptions():
Promise<RenderingOptions>
Returns the rendering options baked into this style. On SketchUp Desktop, this briefly activates the style behind the scenes to read its options — the change is transparent to the user but avoid calling this in a tight loop.
Returns
Section titled “Returns”Promise<RenderingOptions>
refresh()
Section titled “refresh()”refresh():
Promise<Style>
Re-fetches this style from SketchUp to pick up any changes made since this snapshot was taken.
Returns
Section titled “Returns”Promise<Style>
toString()
Section titled “toString()”toString():
string
Returns
Section titled “Returns”string