Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/iarthstar/purescript-sketch

Sketch API JS bindings for development of Sketch Plugin using PureScript
https://github.com/iarthstar/purescript-sketch

library purescript sketch sketch-plugin

Last synced: about 1 month ago
JSON representation

Sketch API JS bindings for development of Sketch Plugin using PureScript

Awesome Lists containing this project

README

        

# purescript-sketch

[![Build Status](https://travis-ci.com/iarthstar/purescript-sketch.svg?branch=master)](https://travis-ci.com/iarthstar/purescript-sketch)

Sketch Javascript API wrapper for development of Sketch Plugin using PureScript

## Add purescript-sketch to your existing plugin projects

```
bower i purescript-sketch
```

## Code Snippet

```purescript
main :: Effect Unit
main = do
Dom.selectedLayers >>= case _ of
Left err -> UI.message "Something went wrong..."
Right layers -> do
if length layers == 0
then UI.alert "No Selection" "Please select a layer and try again..."
else logShow $ foldl (\a b -> a <> b) "" $ mapWithIndex parseLayers layers
where
parseLayers :: Int -> Layer -> String
parseLayers index layer = do
let name = case layer of
Text (TextLayer tl) -> tl.name
Image (ImageLayer il) -> il.name
Shape (ShapeLayer sl) -> sl.name
Group (GroupLayer gl) -> gl.name
Artboard (ArtboardLayer gl) -> gl.name
show index <> ". " <> name
```

## Example Plugins

* [Shadows-Utilities](https://github.com/iarthstar/Shadows-Utilities)
* [Image2Palette](https://github.com/iarthstar/Image2Palette)

## Want to Develop Plugin

* Project Template to start developing plugin :: [Write Sketch Plugins in PureScript](https://github.com/iarthstar/purs-sketch-plugin)