Can you set color of HSB?

Hello,

Currently I'm randomly changing the RGB values to change the environement colors of my game. It's works great, but there are times I get a color that is too dark. I thought I could use Hue, Satuation and Brightness. I then could control it not getting to dark. I might be missing it, but I can't find a variable to set HSB only RGB. Any help would be appreciated.

Thanks

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2015

    @BaDDApple said:
    Hello,

    Currently I'm randomly changing the RGB values to change the environement colors of my game. It's works great, but there are times I get a color that is too dark.

    You can limit the range of the random selection so as to avoid overly dark colours.

    For example, this will give you the full gamut of a 24bit colour palette . . .

    R = random (0,255)/255
    G = random (0,255)/255
    B = random (0,255)/255

    Whereas this will limit the lower values so that the very darkest colour is a mid/dark grey . . .

    R = random (50,255)/255
    G = random (50,255)/255
    B = random (50,255)/255

    @BaDDApple said:
    I thought I could use Hue, Satuation and Brightness. I then could control it not getting to dark. I might be missing it, but I can't find a variable to set HSB only RGB.

    In the colour sector on the Mac version you can select colours using HSB if you want, not sure how this works on the PC version, you can of course covert RGB colours to HSB (and HSB to RGB) values if you need to.

  • BaDDAppleBaDDApple Member Posts: 49

    @Socks. That worked great. Sometimes the easy ways are just stareing you in the face. Thanks for pointing it out to me. Much appreciated.

Sign In or Register to comment.