# Differences

This shows you the differences between two versions of the page.

 design_guide_color [2018/04/28 09:17]z3dev design_guide_color [2018/06/12 14:27] (current)z3dev Both sides previous revision Previous revision 2018/06/12 14:27 z3dev 2018/04/28 10:30 z3dev 2018/04/28 10:30 z3dev 2018/04/28 10:29 z3dev 2018/04/28 10:13 z3dev 2018/04/28 09:59 z3dev 2018/04/28 09:17 z3dev 2018/04/28 09:10 z3dev 2018/04/28 09:09 z3dev 2018/03/21 02:15 z3dev 2018/03/21 02:11 z3dev 2018/03/19 13:58 z3dev 2018/03/08 13:33 z3dev created Next revision Previous revision 2018/06/12 14:27 z3dev 2018/04/28 10:30 z3dev 2018/04/28 10:30 z3dev 2018/04/28 10:29 z3dev 2018/04/28 10:13 z3dev 2018/04/28 09:59 z3dev 2018/04/28 09:17 z3dev 2018/04/28 09:10 z3dev 2018/04/28 09:09 z3dev 2018/03/21 02:15 z3dev 2018/03/21 02:11 z3dev 2018/03/19 13:58 z3dev 2018/03/08 13:33 z3dev created Line 7: Line 7: ​ let a = color("​Red",​sphere()) let a = color("​Red",​sphere()) - let b = color([1,​0.5,​0.3],​sphere()) + let b = color([1, 0.5, 0.3],​sphere()) - let c = color([1,​0.5,​0.3],​sphere(10),​cube(20)) + let c = color([1, 0.5, 0.3, 0.6],​sphere(10),​cube(20)) ​ Line 17: Line 17: ​ let a = object.setColor(css2rgb('​dodgerblue'​)) let a = object.setColor(css2rgb('​dodgerblue'​)) - sphere().setColor(1,​0.5,​0.3) + let b = sphere().setColor(1,​ 0.5, 0.3) - sphere().setColor([1,​0.5,​0.3,​0.7]) + let c = sphere().setColor([1,​ 0.5, 0.3, 0.7]) ​ - The CSG library functions use RGB values between 0 and 1, not 0 and 255. + //Note: There are known issues with transparency, and depending on the order of colors, ​objects may not seem transparent. ​Try different '​alpha'​ values or colors.// - + - Note: There are some Transparency_Sorting|OpenGL Transparency Limitations, e.g. and depending on the order of colors, ​you might not see through otherwise partially ​transparent ​objects. + === Color Space Conversion === === Color Space Conversion === Line 30: Line 28: ​ - let hsl = rgb2hsl(r,​g,​b);​ // or rgb2hsl([r,​g,​b]);​ - let rgb = hsl2rgb(h,​s,​l);​ // or hsl2rgb([h,​s,​l]);​ - let hsv = rgb2hsv(r,​g,​b);​ // or rgb2hsv([r,​g,​b]);​ - let rgb = hsv2rgb(h,​s,​v);​ // or hsv2rgb([h,​s,​v]);​ let rgb = css2rgb('​navy'​) let rgb = css2rgb('​navy'​) + let rgb = html2rgb('#​RRGGBB'​) + + let rgb = hsl2rgb(h,​s,​l) // or hsl2rgb([h,​s,​l]) + let rgb = hsv2rgb(h,​s,​v) // or hsv2rgb([h,​s,​v]) + + let hsv = rgb2hsv(r,​g,​b) // or rgb2hsv([r,​g,​b]) + let hsl = rgb2hsl(r,​g,​b) // or rgb2hsl([r,​g,​b]) + let html = rgb2html(r,​g,​b) ​ Line 42: Line 44: * h,s,v (hue, saturation, value) * h,s,v (hue, saturation, value) - See the http://​openjscad.org/#​examples/​slices/​tor.jscad Tor (multi-color) for an example.