Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Colour simplifier function

Author
Message
FieldDoc
20
Years of Service
User Offline
Joined: 30th May 2003
Location: London, UK
Posted: 7th Jun 2003 16:53 Edited at: 7th Jun 2003 16:54
This is just a small function that takes a colour as a string and returns the RGB integer for you. I have only added 26 colours but it would be a piece of cake to add more. Should simplify things for people who are only making simple colour games or text games.



SYNTAX:
ReturnValue = Colour("red")

Then you could do the following, for instance:
INK ReturnValue, 0

Life is like a penis:
When it's soft you can't beat it, when it's hard you get screwed.
Mattman
20
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 7th Jun 2003 17:16
See u got the pop-up thingy workin' Great!

Cheers,

Mattman

---Mattman
"Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done." Andy Rooney
Killer Sponge
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location: United Kingdom
Posted: 9th Jun 2003 18:07
something else make it so if you put a string with #12421F etc it would return the integers, would be easier for me when storing colour information in files!
K-Sponge

Current Project: KS Modeller Function Library & Editor
andrew11
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 9th Jun 2003 23:20 Edited at: 10th Jun 2003 03:10
You can just use "0x" before the hex value.

Example:
RGB(0x3F,0x4A,0xF0)

Or you can use this code that I made before I knew that you could do the above.

color = hexcolor("000000")


"Food is güd!" -Dean
"All programmers are playwrites and all computers are lousy actors" -Anon
Click Here!!!

Login to post a reply

Server time is: 2024-04-26 20:21:49
Your offset time is: 2024-04-26 20:21:49