Skip to content

Instantly share code, notes, and snippets.

@jodyheavener
Created February 22, 2020 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jodyheavener/4cadd4d2cd7b1993e6dff18e462f6780 to your computer and use it in GitHub Desktop.
Save jodyheavener/4cadd4d2cd7b1993e6dff18e462f6780 to your computer and use it in GitHub Desktop.
Creating simple Rectangles in Adobe XD, Figma, and Sketch
import { Rectangle, Color } from 'scenegraph';
let rectangle = new Rectangle();
rectangle.name = 'Example';
rectangle.width = 100;
rectangle.height = 200;
rectangle.fill = new Color('#2345ac');
rectangle.fillEnabled = true;
let rectangle = figma.createRectangle();
rectangle.name = 'Example';
rectangle.resize(100, 200);
rectangle.fills = [{
blendMode: 'NORMAL',
type: 'SOLID',
visible: true,
opacity: 1,
color: {
b: 0.6745098233222961,
g: 0.2705882489681244,
r: 0.13725490868091583,
},
}];
import { Rectangle, Shape, Style } from 'sketch/dom';
let rectangle = new Shape({
name: 'Example',
frame: new Rectangle(0, 0, 100, 200),
style: {
fills: [{
color: '#2345ac',
fillType: Style.FillType.Color,
enabled: true,
}],
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment