Skip to content

Instantly share code, notes, and snippets.

@peterflynn
Last active October 12, 2018 20:19
Show Gist options
  • Save peterflynn/1a5e1917c7c55038a777a08c507304c5 to your computer and use it in GitHub Desktop.
Save peterflynn/1a5e1917c7c55038a777a08c507304c5 to your computer and use it in GitHub Desktop.
XD Starter Plugin
/*
* Sample plugin code for Adobe XD.
*
* Visit http://adobexdplatform.com/ for API docs and more sample code.
*/
var {Rectangle, Color} = require("scenegraph");
function createRectangle(selection) {
// Insert a red square in the current artboard or group/container
var shape = new Rectangle();
shape.width = 100;
shape.height = 100;
shape.fill = new Color("#f00");
selection.insertionParent.addChild(shape);
}
module.exports = {
commands: {
myPluginCommand: createRectangle
}
};
{
"name": "Starter Plugin Sample",
"id": "YOUR_ID_HERE",
"version": "1.0.0",
"description": "Sample plugin code for Adobe XD, providing starter project scaffolding.",
"host": {
"app": "XD",
"minVersion": "13.0.0"
},
"uiEntryPoints": [
{
"type": "menu",
"label": "Plugin Hello World",
"commandId": "myPluginCommand"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment