Complete the code to set the fill color of a shape to red in Figma.
node.fills = [{ type: 'SOLID', color: { r: 1, g: [1], b: 0 } }];The green (g) value should be 0 to get pure red color in RGB.
Complete the code to create a text node with color blue in Figma.
const text = figma.createText();
text.fills = [{ type: 'SOLID', color: { r: 0, g: 0, b: [1] } }];Blue color has blue channel set to 1, red and green are 0.
Fix the error in the code to set a rectangle's fill color to green in Figma.
const rect = figma.createRectangle();
rect.fills = [{ type: 'SOLID', color: { r: 0, g: [1], b: 0 } }];Green color uses green channel = 1 in Figma's 0-1 scale.
Fill both blanks to create a semi-transparent red fill in Figma.
node.fills = [{ type: 'SOLID', color: { r: [1], g: 0, b: 0 }, opacity: [2] }];Red color uses r=1, and opacity 0.5 makes it semi-transparent.
Fill all three blanks to create a yellow fill with 80% opacity in Figma.
node.fills = [{ type: 'SOLID', color: { r: [1], g: [2], b: [3] }, opacity: 0.8 }];Yellow is red=1, green=1, blue=0. Opacity is set to 0.8 outside the blanks.
