Sketch 53 13

broken image


Sketch gives you drawing tools that interact naturally with the canvas, including a graphite pencil, ink pen, and blending markers. Built-in brushes open up even more creative possibilities. Use Split View to keep your drawings and toolbox side by side on the same screen. Download Sketch Version 53 Requires macOS High Sierra (10.13.4) or newer Details Color Picker. Color presets added to Document Colors are now included in Libraries; Fill presets can now be named and viewed in list, as well as grid view; Support has been included to view color values in HSL.

  1. Sketch 53 136
  2. Sketch 53 13 St

Released 05 February, 2019 – read release notes

Changes

The document from a library will now have a proper path (either local path or the appcast URL)

Previously when you used library.getDocument() the path of the Document would be undefined. It's now set correctly.

Added exportFormats property on Layer

You can specify size, suffix, prefix, and fileFormat, valid file formats are:

  • jpg
  • png
  • tiff
  • eps
  • pdf
  • webp
  • svg

Usage

Added method to get the theme of Sketch

Sketch has 2 themes: light and dark. If your plugin has some custom UI, it should support both as well.

Usage

Specify object types less often

Pretty much every object from the JS API is a wrapper around a native object (like ExportFormats is a wrapper around MSExportFormat). The way the API works when creating a new wrapper is that it looks at the type field to create the underlying native object. But in some cases, there are no choices: the objects inside exportFormats will always be MSExportFormat.

Sketch 53 13

Usage

Instead of:

you can just write:

Add UI.getInputFromUser method and deprecate the other input methods

The same UI inputs are there (String and Select) but its moved over to the method UI.getInputFromUser

Deprecated

  • UI.getStringFromUser(message, initialValue)
  • UI.getSelectionFromUser(message, items, selectedItemIndex)

Bonus

Slider, Number, Color, and Path inputs are coming soon

Usage

Added some getParent* methods on Layer

You can use getParentPage(), getParentArtboard(), getParentSymbolMaster(), and getParentShape() to quickly access higher level components.

Sketch 53 136

Note that you can also use the parent property on Layer to go up the layer structure.

Usage

Added support for text styles

LOTS of added functionality here.

Deprecated

  • Text.systemFontSize
  • Text.alignment (its moved to Text.style.alignment)

Added properties to Text.style

  • alignment
    • left, center, right, justified
  • verticalAlignment
    • top, center, bottom
  • kerning
    • default to null if there is none set
    • (there was an a floating point issue with the returned values but its been fixed hereGitHub PR)
  • lineHeight
    • defaults to null if nothing is set
    • You can get the default line height from the method getDefaultLineHeight() (GitHub PR)
  • textColor
    • note that it can set in various formats #000, #000000, and the opacity variant #000000FF
  • fontSize
  • textTransform
    • uppercase, lowercase, and none
  • fontFamily
  • fontWeight
    • Default is 5
    • If you attempt to set the weight to something that the font doesn't support Sketch will attempt to pick the closest one.
  • fontStyle
    • italic , normal
    • default to undefined
    • setting this property to normal will return undefined if you later read it
  • fontStretch
    • condensed, normal
    • default to undefined
    • setting this property to normal will return undefined if you later read it
  • textUnderline
    • single, none, double dot, dot double, thick dash-dot
    • default to undefined
    • setting this property to double dot or dot double will both return double dot if you later read it
    • setting this property to none will return undefined if you later read it
  • textStrikethrough
    • single, none, double dot, dot double, thick dash-dot
    • default to undefined
    • setting this property to double dot or dot double will both return double dot if you later read it
    • setting this property to none will return undefined if you later read it

Usage

Added some methods to store a session variable

Session variables let you store a value which is persisted when the plugin finishes to run but is not persisted when Sketch closes. It is useful when you want to keep a value between plugin's runs.

Note that you still have setSettingForKey which will let you store things after closing Sketch.

Usage

Allow using setting methods even from the Run Script panel

Previously you couldn't test anything from 'sketch/settings' in the script panel and now you can!

Ability to make Slices

You can make one by:

You can also pass in exportFormats and a parent to tie it to a layer or object.

Usage

setTimeout and all the other timeout, interval, immediate methods are now available directly, no need to polyfill them

GitHub pull request(This is the probably the PR however the diff seems to be about fixing an issue with fragments 🤔)

A useful new method on the path module to get resources in the plugin bundle

require('path').resourcePath(string) returns the path to a resource in the plugin bundle or undefined if it doesn't exist.

A new action was added called LayersResized

The action context for this action contains two keys:

  • document: The document where the action was triggered
  • layers: An array of the layers being resized

Usage

You can now control whether or not a property is editable for a Symbol Source override. Symbol instance overrides also have a property called editabled

Usage

Obj-C exceptions will be thrown as JS Errors which will reference the exception in their nativeException property

You can now detach symbol instances recursively so that nested symbols also detach

  • instance.detach() will just detach the outer symbol
  • instance.detach({recursively:true}) will detach nested symbols as well

You can now rotate layers. In addition, you can flip them vertically or horizontally

These can be found under the transform property, you can set and get them as you would expect.

Usage

You can now get access to an Artboard's background properties

  • background.enabled: boolean, if the background is shown or not
  • background.includedInExport: boolean, if the background should be exported or if it should be transparent during the export
  • background.color: string, the rgba representation of the background color

Usage

export can now export to JSON

Usage

Related resources

Sketch 53 13 St

See something wrong or incomplete? Improve this page.




broken image