summaryrefslogtreecommitdiffstats
path: root/playgrounds/colors/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'playgrounds/colors/main.js')
-rw-r--r--playgrounds/colors/main.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/playgrounds/colors/main.js b/playgrounds/colors/main.js
new file mode 100644
index 0000000..fda3ce2
--- /dev/null
+++ b/playgrounds/colors/main.js
@@ -0,0 +1,29 @@
+
+
+let canvas = SVG('#canvas').group()
+ .translate( -150, 230 )
+
+// Make a bunch of rectangles
+function rectangles ( method='Vibrant') {
+
+ // Make a group
+ let group = canvas.group()
+ group.text(method).attr('font-size', 50).move( -230, 20 )
+
+ // Add the squares
+ for ( let i = 0; i < 20; i++ ) {
+ let color = SVG.Color.random( method.toLowerCase() ).hex()
+ let rect = group.rect(100, 100)
+ .x( 20 + 100 * i )
+ .fill( color )
+ }
+ return group
+}
+
+rectangles( 'Vibrant' ).translate( 0, 100 )
+rectangles( 'Sine' ).translate( 0, 220 )
+rectangles( 'Pastel' ).translate( 0, 340 )
+rectangles( 'Dark' ).translate( 0, 460 )
+rectangles( 'RGB' ).translate( 0, 580 )
+rectangles( 'LAB' ).translate( 0, 700 )
+rectangles( 'Grey' ).translate( 0, 820 )