How do I generate a random hex code that of a lighter color in javascript?

hex, javascript

Solution

What I would do is generate a number from 00 to FF for each (RGB) (ie `000000` to `FFFFFF`). I would also make sure the G value is approximately higher than 33.

Problem

I am using a random color for the background, but since the text is black, when really dark colors are generated, the text can't be seen. How do I exclude these dark colors when generating the hexadecimal code? I could only figure out how to get this: `Math.floor(Math.random()*16777215).toString(16)` But this does not exclude dark colors. Could someone please help me? Thank you in advance!

Original source

Related problems