OpenSCAD User Manual/Changing the colour of an object
To draw pieces of different colours, use the instruction color in front of the piece.
To do color: color("red") cube(20); specify the color with the name in commas.
To do a transparency: color("green",0.5) cylinder(r=20, h=30); insert an optional parameter with value in 0 to 1
To do with RGB color: color([150/255, 60/255, 200/255],0.8) sphere(20);
We can define the color with the RGB code, dividing every number in 255 or/and adding a transparency.