Delete Icon
This forum is now read-only. Please use our new forums at
0 points
Submitted by Judy
6 years ago

Can I make more colors?

There are many ways to define colors. In this project we are using HSL (Hue, Saturation, Lightness). You can read about HSL and other color models here.

In this project you take an array with 3 numbers and assign it a name. You are free to use any words as your array names.

var red = [0, 100, 63];
var tomato = [0, 100, 63];
var punchBuggy = [0, 100, 63];

In the case of red, Hue is 0, Saturation is 100% and Lightness is 63%.

There are many online tools to help you choose new colors. here is one, and here is another

More Colors

If you make a new color like this:

var tardis = [230, 58, 24];

Then you can use your new color in your letterColors array. If you want more than one letter of each color, in a row, then you can build up a pattern like this:

letterColors = [tardis, tardis, tardis, punchBuggy];

Return to Frequently Asked Questions

Answer 53e1160a282ae3b2c600002e

0 votes


How can I make the colors random?

217 points
Submitted by ipodlover3354
6 years ago


Judy 6 years ago

Computers are great at picking seemingly random numbers. Have you learned how to get JavaScript to do that for you yet? You’ll need to learn how to use Math.random() – With that knowledge you could generate random number for the three numbers in the colour arrays. Or you could learn a bit more about array indexes and put random colours into the letterColors array. The first place I remember seeing Math.random() here is in the Rock Paper Scissors game you build in the fourth section of the JavaScript track

ipodlover3354 6 years ago

Yea, I am actually on the lesson all about Math.