Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/iarthstar/purescript-sketch
- Owner: iarthstar
- License: mit
- Created: 2019-05-03T13:02:01.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-30T19:34:03.000Z (almost 5 years ago)
- Last Synced: 2024-11-10T19:53:37.807Z (about 1 month ago)
- Topics: library, purescript, sketch, sketch-plugin
- Language: PureScript
- Homepage:
- Size: 48.8 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)