Created
November 23, 2024 03:08
-
-
Save hiloki/23052e8be7fb7624d1066b19719cabbc to your computer and use it in GitHub Desktop.
Color Swatch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const colors = [ | |
figma.util.rgb("#bbf7d0"), | |
figma.util.rgb("#86efac"), | |
figma.util.rgb("#4ade80"), | |
figma.util.rgb("#22c55e"), | |
figma.util.rgb("#16a34a"), | |
]; | |
const rectangleWidth = 100; // 矩形の幅 | |
const rectangleHeight = 100; // 矩形の高さ | |
const spacing = 20; // 矩形間のスペース | |
colors.forEach((color, index) => { | |
const rect = figma.createRectangle(); | |
rect.resize(rectangleWidth, rectangleHeight); | |
rect.x = index * (rectangleWidth + spacing); // 水平方向に並べる | |
rect.y = 0; // 垂直方向は同じ位置 | |
rect.fills = [{ type: "SOLID", color: color }]; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment