Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript javascript HEX color from HSB

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #42247
    JokerMartini
    Participant

    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));

    #122315
    rosspenman
    Participant

    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

    #122357
    JokerMartini
    Participant

    are HSB and HSL the same?

    #122374
    rosspenman
    Participant

    HSB is the same as HSV.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.