Skip to content

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.

let model = await SketchUpApi.getActiveModel();
// Read the active style
let selected = await model.getSelectedStyle();
let currentStyle = selected.style;
console.log(currentStyle.name);
// => '[Architectural Design Style]'
// Duplicate it, tweak it, and make it active
await 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

readonly attributes: Attributes

User-defined key-value data attached to this style.


readonly description: string

A text description of this style.


readonly fileName: string

The file name of this style on disk.


readonly id: number

The persistent numeric identifier for this style, stable across sessions.


readonly name: string

The display name of this style, like '[Architectural Design Style]'.


readonly type: Style = EntityType.Style

get sketchupId(): SketchupId

JS API identifier for this style. Pass it to API methods that accept a sketchupId.

SketchupId


get typeName(): string

Returns a named variant of the type field.

SDK 2.35.0

string

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.

Promise<RenderingOptions>


refresh(): Promise<Style>

Re-fetches this style from SketchUp to pick up any changes made since this snapshot was taken.

Promise<Style>


toString(): string

string