├── .gitignore ├── sketch-radius-demo.gif ├── sketchpack.json ├── CornerRadius.sketchplugin └── Contents │ └── Sketch │ ├── Increase Radius.cocoascript │ ├── Decrease Radius.cocoascript │ ├── Decrease Radius by 10.cocoascript │ ├── Increase Radius by 10.cocoascript │ └── manifest.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /sketch-radius-demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/arjenvr/sketch-radius/HEAD/sketch-radius-demo.gif -------------------------------------------------------------------------------- /sketchpack.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Corner Radius Shortcuts", 3 | "version": "1.1", 4 | "description": "Sketch app plugin to increase or decrease the corner radius of rectangle shapes in increments of 1 or 10.", 5 | "tags": ["radius", "rounded", "corner", "style", "rectangle", "photoshop"] 6 | } 7 | -------------------------------------------------------------------------------- /CornerRadius.sketchplugin/Contents/Sketch/Increase Radius.cocoascript: -------------------------------------------------------------------------------- 1 | // Increase corner radius by 1 2 | 3 | var onRun = function(context) { 4 | var layer = context.selection.firstObject(); 5 | if(layer && layer.isKindOfClass(MSShapeGroup)) { 6 | var shape=layer.layers().firstObject(); 7 | if(shape && shape.isKindOfClass(MSRectangleShape)) { 8 | var radius=shape.cornerRadiusFloat(); 9 | var newRadius=radius + 1; 10 | shape.cornerRadiusFloat=newRadius; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /CornerRadius.sketchplugin/Contents/Sketch/Decrease Radius.cocoascript: -------------------------------------------------------------------------------- 1 | // Decrease corner radius by 1 2 | 3 | var onRun = function(context) { 4 | var layer = context.selection.firstObject(); 5 | if(layer && layer.isKindOfClass(MSShapeGroup)) { 6 | var shape=layer.layers().firstObject(); 7 | if(shape && shape.isKindOfClass(MSRectangleShape)) { 8 | var radius=shape.cornerRadiusFloat(); 9 | var newRadius=radius - 1; 10 | shape.cornerRadiusFloat=newRadius; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /CornerRadius.sketchplugin/Contents/Sketch/Decrease Radius by 10.cocoascript: -------------------------------------------------------------------------------- 1 | // Decrease corner radius by 10 2 | 3 | var onRun = function(context) { 4 | var layer = context.selection.firstObject(); 5 | if(layer && layer.isKindOfClass(MSShapeGroup)) { 6 | var shape=layer.layers().firstObject(); 7 | if(shape && shape.isKindOfClass(MSRectangleShape)) { 8 | var radius=shape.cornerRadiusFloat(); 9 | var newRadius=radius - 10; 10 | shape.cornerRadiusFloat=newRadius; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /CornerRadius.sketchplugin/Contents/Sketch/Increase Radius by 10.cocoascript: -------------------------------------------------------------------------------- 1 | // Increase corner radius by 10 2 | 3 | var onRun = function(context) { 4 | var layer = context.selection.firstObject(); 5 | if(layer && layer.isKindOfClass(MSShapeGroup)) { 6 | var shape=layer.layers().firstObject(); 7 | if(shape && shape.isKindOfClass(MSRectangleShape)) { 8 | var radius=shape.cornerRadiusFloat(); 9 | var newRadius=radius + 10; 10 | shape.cornerRadiusFloat=newRadius; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /CornerRadius.sketchplugin/Contents/Sketch/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "commands" : [ 3 | { 4 | "script" : "Increase Radius.cocoascript", 5 | "handler" : "onRun", 6 | "shortcut" : "cmd ]", 7 | "name" : "Increase Radius", 8 | "identifier" : "increase_radius" 9 | }, 10 | { 11 | "script" : "Decrease Radius.cocoascript", 12 | "handler" : "onRun", 13 | "shortcut" : "cmd [", 14 | "name" : "Decrease Radius", 15 | "identifier" : "decrease_radius" 16 | }, 17 | { 18 | "script" : "Increase Radius by 10.cocoascript", 19 | "handler" : "onRun", 20 | "shortcut" : "cmd shift ]", 21 | "name" : "Increase Radius by 10", 22 | "identifier" : "increase_radius_by_10" 23 | }, 24 | { 25 | "script" : "Decrease Radius by 10.cocoascript", 26 | "handler" : "onRun", 27 | "shortcut" : "cmd shift [", 28 | "name" : "Decrease Radius by 10", 29 | "identifier" : "decrease_radius_by_10" 30 | } 31 | ], 32 | "menu" : { 33 | "items" : [ 34 | "increase_radius", 35 | "decrease_radius", 36 | "increase_radius_by_10", 37 | "decrease_radius_by_10" 38 | ], 39 | "title" : "Corner Radius" 40 | }, 41 | "identifier" : "nl.arjenvr.sketch.radius", 42 | "version" : "1.1", 43 | "description" : "Increase or decrease the corner radius on rectangle shapes using keyboard shortcuts.", 44 | "homepage" : "https://github.com/arjenvr/sketch-radius", 45 | "author" : "Arjen van Reeven", 46 | "name" : "Corner Radius Shortcuts" 47 | } 48 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Corner Radius Shortcuts plugin for Sketch 2 | ========================================= 3 | 4 | Increase or decrease the corner radius on rectangle shapes using keyboard shortcuts. 5 | 6 | ![Sketch Radius Demo](https://github.com/arjenvr/sketch-radius/raw/master/sketch-radius-demo.gif) 7 | 8 | ##Keyboard shortcuts 9 | 10 | | Command | Shortcut | 11 | |-----------------------|--------------------------------------------------| 12 | | Increase Radius | command + ] | 13 | | Decrease Radius | command + [ | 14 | | Increase Radius by 10 | command + Shift + ] | 15 | | Decrease Radius by 10 | command + Shift + [ | 16 | 17 | ##Installation 18 | 19 | ### Download and extract ZIP 20 | 1. [Download the ZIP file containing Corner Radius Shortcuts](https://github.com/arjenvr/sketch-radius/archive/master.zip) 21 | 2. Copy the contents to the plugin folder (Open up Sketch, go to `Plugins` › `Reveal Plugins Folder…` to open it.) 22 | 23 | ### Using GitHub for Mac 24 | _NOTE: This requires [GitHub for Mac](https://mac.github.com) to be installed._ 25 | 26 | 1. Click the [Clone in Desktop](github-mac://openRepo/https://github.com/arjenvr/sketch-radius) button on GitHub 27 | 2. Open up Sketch, go to `Plugins` › `Reveal Plugins Folder…` to open the plugins folder in Finder. Drag the folder by its icon from the Finder window into the Open dialog of GitHub for Mac. 28 | 29 | ## Known issues 30 | * The radius of all corners will be set uniformly based on the radius of the top left corner. If your shape has different radii on individual corners they will be lost. 31 | * Negative values are allowed even though these have no effect 32 | 33 | ## Acknowledgements 34 | * Prompted by a question from [Oleg Kuroptiev](https://twitter.com/bass_blog) 35 | * Inspired by the keyboard shortcuts for the rounded rectangle tool in Photoshop 36 | * Based on examples from [Sketch Plugins Cookbook](https://github.com/turbobabr/Sketch-Plugins-Cookbook) 37 | * [Round Rects Are Everywhere!](http://www.folklore.org/StoryView.py?story=Round_Rects_Are_Everywhere.txt) 38 | 39 | ##Contact 40 | * [@arjenvr](https://www.twitter.com/arjenvr) on Twitter 41 | --------------------------------------------------------------------------------