meta data for this page
Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
en:design_guide_color [2020/12/01 00:54] JSCAD Editor |
en:design_guide_color [2021/05/29 08:48] (current) JSCAD Editor |
||
|---|---|---|---|
| Line 2: | Line 2: | ||
| Shapes can exhibit different colors. And just like the other transformations, | Shapes can exhibit different colors. And just like the other transformations, | ||
| + | |||
| + | Colors are not only important for visual rendering but also controlling the selection of filaments during 3D printing. Therefore, colors should be applied as the last step in designs to insure proper printing. | ||
| <code javascript> | <code javascript> | ||
| - | let myshape = color([1, 0, 0], sphere()) // red | + | const myshape = colorize([1, 0, 0], sphere()) // RGB red |
| - | let myshape = color([1, 0.5, 0.3], sphere()) // ?? | + | const myshape = colorize([1, 0.5, 0.3], sphere()) // color |
| - | let myshape = color([1, 0.5, 0.3, 0.6], sphere(10), cube(20)) // color plus alpha transparency | + | const myshape = colorize([1, 0.5, 0.3, 0.6], sphere()) // color plus alpha transparency |
| </ | </ | ||
| - | |||
| - | See the [[https:// | ||
| //Note: There are known issues with transparency, | //Note: There are known issues with transparency, | ||
| Line 15: | Line 15: | ||
| === Color Space Conversion === | === Color Space Conversion === | ||
| - | Following | + | There are several |
| <code javascript> | <code javascript> | ||
| - | let rgb = css2rgb('navy') | + | const wildcylinder |
| - | let rgb = html2rgb('# | + | |
| - | let rgb = hsl2rgb(h,s,l) // or hsl2rgb([h,s,l]) | + | const bluesphere |
| - | let rgb = hsv2rgb(h,s,v) // or hsv2rgb([h, | + | |
| - | let hsv = rgb2hsv(r,g,b) // or rgb2hsv([r,g,b]) | + | const mysphere |
| - | let hsl = rgb2hsl(r,g,b) // or rgb2hsl([r,g,b]) | + | |
| - | let html = rgb2html(r,g,b) | + | const mysphere |
| </ | </ | ||
| whereas | whereas | ||
| - | * r,g,b (red, green, blue) | + | * r,g,b (red, green, blue) of [[https:// |
| - | * h,s,l (hue, saturation, lightness) | + | * h,s,l (hue, saturation, lightness) |
| - | * h,s,v (hue, saturation, value) | + | * h,s,v (hue, saturation, value) |
| + | |||
| + | See the [[https:// | ||