Hex colour generator 2

user_avatar Made by: Jack8680
developer

PROJECT DESCRIPTION

Share this project:

A tool that lets you enter percentages of red, green, and blue through sliders or text inputs to generate a hex colour for use with the set colour behaviour. Feel free to branch/copy this and use it in your own game.

Features:
- Touch sliders
- Precise inputs (tap the numbers)
- Inverting colours
- Text automatically becomes white if the background is dark and black if the background is bright
- Hex colour display

VERSION 2.0

Last Updated: September 21, 2022

- Improved speed a lot by using for loops rather than timers
- Added a help screen
- Removed a few unnecessary wait 0 second behaviours

COMMENTS

YOU MUST BE SIGNED IN TO LEAVE A COMMENT

July 01, 2016

Maybe make the color pop up in a text box when you click on the value at the bottom so people can copy paste it.

July 01, 2016

That's a good idea but I don't think adding 2 behaviours justifies another update 😛

July 01, 2016

I might add Hue/Saturation/Brightness sliders too, but I don't completely understand how they work so I haven't done that yet

July 01, 2016

Great example. I might use this in my draw tool later.

July 01, 2016

Really cool creations being made based off my starting idea.

July 01, 2016

I actually made this a long while ago, this is just an update that improves it.

July 02, 2016

Oh, ok. Still really cool!

July 01, 2016

NIce work! I like how you change the UI to white/black depending on darkness of colour. Really great user experience design there!

July 01, 2016

Thanks, the only problem is that apparently different colours have different brightness (blue is darker than green), so it is hard to read at 51% blue and 0% green and red, but it's not too bad 😀

February 16, 2016

Good job

February 15, 2016

I love it! This is very cool! What does the code mean though?

February 15, 2016

It's a hex code for using in a set colour behaviour. There are 4 sets of 2 digit hexadecimal values: Red, Green, Blue and Opacity. The minimum for a hex value is 0, the maximum is FF. Hexadecimal means that it is base 16, rather than base 10 which is normal counting. This means that counting to 16 is 1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,10. So FF is 255. I convert the percentage of colour to a hex value by multiplying by 2.55 and then rounding it to get it to a number between 0 and 255, I then convert it to base 16 by running the following loop:

While number/16>0

A=Number mod 16 (in base form 0123456789ABCDEF) combined with A

Number=number/16 (floored)

Where number starts of as the value between 0 and 255, and floored is using the round behaviour on floor setting. To convert the number to hexadecimal, I set the input field of the combine text (with A) to the value, then if it's 10 I set the input to A, if 11 to B, etc. for C, D, E and F. I do this for each colour, then I combine the 3 hex values into a six digit code and add FF at the end for the opacity (I could have done opacity as an option, but I didn't). To inverse the colour I did the same thing but for the value between 0 and 255 I simply subtracted the current colour value from 255.

E.g. 100% red, 50% green, 25% blue

Becomes 255 red, 128 green, 64 blue. 255 in hex is FF, 128 in hex is 80, and 64 in hex is 40. This creates a hex code of FF8040FF.

To inverse it, red becomes 0, green becomes 127 (due to rounding), blue becomes 191, which in hex become 00, 7F, BF. Which combine to 007FBFFF.

January 22, 2016

Really cool!

January 22, 2016

this game is very good

January 21, 2016

Very clever!