-
Notifications
You must be signed in to change notification settings - Fork 0
/
code.ts
38 lines (31 loc) · 860 Bytes
/
code.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const clone = (value) => JSON.parse(JSON.stringify(value));
const setFill = (
node: StickyNode,
red: number,
green: number,
blue: number
) => {
const fills = clone(node.fills);
fills[0].color.r = red;
fills[0].color.g = green;
fills[0].color.b = blue;
node.fills = fills;
};
figma.on("selectionchange", () => {
const nodes = figma.currentPage.findAllWithCriteria({ types: ["STICKY"] });
nodes.forEach((node) => {
let text = node.text.characters.toLowerCase();
if (text.startsWith("i like")) {
setFill(node, 0.52, 0.88, 0.64);
}
if (text.startsWith("i wish")) {
setFill(node, 1.0, 0.69, 0.64);
}
if (text.startsWith("i wonder")) {
setFill(node, 1.0, 0.77, 0.44);
}
if (text.startsWith("we will") || text.startsWith("i will")) {
setFill(node, 0.15, 0.73, 0.9);
}
});
});