Grow your CSS skills. Land your dream job.

javascript HEX color from HSB

  • # January 25, 2013 at 10:13 am

    Is there a way to generate a HEX color but within a range of HSB values?

    These are the HSB ranges I want to use.
    H: 0 – 360
    S: 50 – 85
    B: 80 – 100

    This generates a random hex color….found here on CSS-Tricks
    (Math.floor(Math.random()*16777215).toString(16));

    # January 25, 2013 at 3:03 pm

    There’s all sorts of crazy math involved with this, but it is possible. This might be a good starting point: http://en.wikipedia.org/wiki/HSL_and_HSV#Converting_to_RGB

    # January 25, 2013 at 9:20 pm

    are HSB and HSL the same?

    # January 26, 2013 at 4:09 am

    HSB is the same as HSV.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".