From 8151b6a3a9fbd6eac2591b7ddead6758a09e3b60 Mon Sep 17 00:00:00 2001 From: Joshua Seigler Date: Thu, 24 Aug 2017 16:49:42 -0400 Subject: [PATCH] :zap: Use specific confetti colors --- confetti.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/confetti.js b/confetti.js index 8f64468..ac027c8 100644 --- a/confetti.js +++ b/confetti.js @@ -4,6 +4,15 @@ 'use strict'; var DEFAULT_NUM_CONFETTI = 500, + CONFETTI_COLORS = [ + "white", + "purple", + "#D12D23", + "#C1141A", + "#DD7512", + "#EAA813", + "#1BA58E" + ], animate = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || @@ -87,9 +96,10 @@ }; function color() { - return 'rgba(' + randomFrom(0, 256) + ', ' + - randomFrom(0, 256) + ', ' + - randomFrom(0, 256) + ', ' + Math.random() + ')'; + // return 'rgba(' + randomFrom(0, 256) + ', ' + + // randomFrom(0, 256) + ', ' + + // randomFrom(0, 256) + ', ' + Math.random() + ')'; + return CONFETTI_COLORS[randomFrom(0,CONFETTI_COLORS.length)]; } function randomFrom(a, b, factor) {