Home Reference Source
import {Style} from './api/Style.js'
public class | source

Style

Extends:

WrappedObject → Style

Represents a Sketch layer style.

Static Method Summary

Static Public Methods
public static

tests(): dictionary

Return a list of tests to run for this class.

Constructor Summary

Public Constructor
public

constructor(style: MSStyle)

Make a new style object.

Member Summary

Public Members
public set

borders(values: array): *

Set the borders to use for this style.

public set

fills(values: array): *

Set the fills to use for this style.

Method Summary

Public Methods
public

colorFromString(value: *): *

Given a string description of a color, return an MSColor.

Inherited Summary

From class WrappedObject
public static

tests(): dictionary

Return a list of tests to run for this class.

public get

id: string: *

Returns the object ID of the wrapped Sketch model object.

public get

Returns the wrapped Sketch object.

Static Public Methods

public static tests(): dictionary source

Return a list of tests to run for this class.

Return:

dictionary

A dictionary containing the tests to run. Each key is the name of a test, each value is a function which takes a Tester instance.

Public Constructors

public constructor(style: MSStyle) source

Make a new style object.

Params:

NameTypeAttributeDescription
style MSStyle

The underlying model object from Sketch.

Public Members

public set borders(values: array): * source

Set the borders to use for this style.

The value provided is a list of items, with each one representing a style.

Currently these values can only be strings with css-style color specifications such as #ffee33 (alpha values are supported too, so #aabbccdd is valid).

These strings are used to create simple borders.

In the future the intention is to also support dictionaries allowing gradients and other more complex border parameters to be specified.

public set fills(values: array): * source

Set the fills to use for this style.

The value provided is a list of items, with each one representing a style.

Currently these values can only be strings with css-style color specifications such as #ffee33 (alpha values are supported too, so #aabbccdd is valid).

These strings are used to create simple fills.

In the future the intention is to also support dictionaries allowing gradients and other more complex fill parameters to be specified.

Public Methods

public colorFromString(value: *): * source

Given a string description of a color, return an MSColor.

Params:

NameTypeAttributeDescription
value *

Return:

*
See something wrong or incomplete? Improve this page.