## As: Rgb

• 2,582 Views
• 20 Replies
Snubby
Snubby
• Member since: Dec. 4, 2004
• Offline.
Forum Stats
Member
Level 21
Game Developer
As: Rgb 2006-07-11 14:41:51

AS: MAIN

What is RGB?
RGB stands for Red Green Blue. It is how colours are made on your computer. In real life, there are 3 primary colours; yellow, blue and red. Combining these colours can make any colour. On a computer, there are red, green and blue. Similarly, combining these colours can make any colour. In Flash, if you open up your colour pallet underneath the colour you will see a textbox labelled 'Hex'. Another word for RGB is Hexidecimal.

What will I Learn?
You will learn how to write RGB / Hexidecimal values without having to look at your colour pallet.

WHY?!?!
It is always good to know how things work. When using Flash, you don't ever NEEEED to know how to write Hex, but it's good to know what your doing. Also, you may find yourself someday coding something, and you don't have a colour pallet! Luckily, you will have learned how to program Hex already.

Digits

- Metric System -
In the Metric System (the way numbers are formed), each digit can have one of 10 values...

0, 1, 2, 3, 4, 5, 6, 7, 8, 9

In RGB, each digit can have one of 16 values...

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.

- Forming a Hex Value -
A Hexidecimal Value always has 6 digits. The first two stand for the red, the second two stand for the green, and the third two stand for the blue, hence the name RGB. Hex values always have a '#' infront of them, and a '0x' in Actionscript.

- Setting the Values -
So, start off with 0 values...

#000000

Now, lets break it down...

00 00 00
R...G...B..

If I want to add one to red, I would go like this...

010000.

If I wanted to add nine to red, I would go like this...

090000

If I wanted to add ten to red, I would go like this...

0A0000

Get it? Now, as long as the red value is less than 16, I won't need to fill the first digit of red. Just like in the Metric System, you don't have to fill the tens column until there is more than 9.

0F0000 - This is 15 red.

Once I add more to red, it starts over, and ticks one in the first digit.

100000 - This is 16 red.

The most you can give to red is 256, which is expressed like this.

FF0000.

Here are some more examples of red...

000000 - 0 red, 0A0000 - 10 red, 400000 - 60 red.

The total six digits are just the combination of the 2 reds, the 2 greens, and the 2 blues.

010101 - one red one green one blue.

Colours

In RGB, if you have the full amount of all the colours...

FFFFFF

You get white. If you have no colours at all...

000000

You get black. If all you have is red...

FF0000

You get pure red. Similarly with the other colours...

00FF00 - pure green, 0000FF - pure blue.

By just using the different combinations of pure colours, you can get 8 different pure colours...

FFFFFF - white, 000000 - black, FF0000 - red, 00FF00 - green, 0000FF - blue, FFFF00 - yellow, FF00FF - pink, 00FFFF - cyan

Now that you know how to make colours, you just need to know how to add white and add black to those colours; which is easy! If FFFFFF is all white, and 000000 is all black, you just add equally to all colours to brighten it, and subtract equally from all colours to darken it. For example...

FF0000, here is pure red. I want to make it darker, so I'm going to subtract 10 (A) from all colours. I get...

FE0000, which is a small difference. If I want to drastically make it darker, I can subtract, say, half of it.

880000, that is a dark red. Remember, the other digits stay the same because I cannot subtract from them when they are already 0.

0DD082 - That is a terquoise colour. In this instance, if I want to make it darker, I CAN subtract from all colours. I'll subtract 05.

08EA7C - That is the same colour, but darker. If I wanted to brighten the original colour, I could add to all, say, 05.

0FFF83 - That is a brighter version of the same colour.

- - - - - - - - - -

So by now you should be able to make your own colours. Good luck!

hashbrown
hashbrown
• Member since: Jul. 7, 2005
• Offline.
Forum Stats
Member
Level 16
Blank Slate
Response to As: Rgb 2006-07-11 15:04:55

D:, no one responded after snubby wasted his precious life. although this wont help me because i h8 as, i have to say kudos for the effort you put i. good job :)

Glaiel-Gamer
Glaiel-Gamer
• Member since: Dec. 28, 2004
• Offline.
Forum Stats
Member
Level 28
Game Developer
Response to As: Rgb 2006-07-11 15:05:15

At 7/11/06 02:41 PM, Snubby wrote: - Metric System -
In the Metric System (the way numbers are formed), each digit can have one of 10 values...

0, 1, 2, 3, 4, 5, 6, 7, 8, 9

It's called DECIMAL for base-10

In RGB, each digit can have one of 16 values...

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

A = 10, B = 11, C = 12, D = 13, E = 14, F = 15.

It's called hexidecimal for base-16 (deci = 10, hex = 6)

At least learn the terms.

And you basically explained the terms. There wasnt any AS, you didnt explain how to convert from r, g, b to hex form, you didnt explain what the 0x means (it meant interpret the number as hex).

You didnt explain how to extract the colors from a hex number, like given 0xF39DD0 how to seperate it into r, g, b WITH CODE (cause more often than not, that's how you'll do it)

It's a good start, now take this information and put it to a practical use.

Snubby
Snubby
• Member since: Dec. 4, 2004
• Offline.
Forum Stats
Member
Level 21
Game Developer
Response to As: Rgb 2006-07-11 15:11:38

At 7/11/06 03:05 PM, Glaiel_Gamer wrote: It's a good start, now take this information and put it to a practical use.

Maybe your right, idc. but at the start where it said why, all of the 'why' aspect was covered in the tutorial, so whether or not I explained how to separate RGB is irrelevant becuase that wasn't included in the lesson plan.

There is no RGB in AS:MAIN so as of now i think this is usefull.

JackToon
JackToon
• Member since: Mar. 11, 2006
• Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to As: Rgb 2006-07-11 15:13:38

nice job

GuyWithHisComp
GuyWithHisComp
• Member since: Nov. 10, 2005
• Offline.
Forum Stats
Member
Level 28
Blank Slate
Response to As: Rgb 2006-07-13 12:50:02

This isn't really AS:Main material since it's no actionscripts, at all. AS:Main is tutorials to learn Actionscript. This is more like UsefulTecniques:Main.
I'm not saying it's not important. Just that it's not really as.

KaynSlamdyke
KaynSlamdyke
• Member since: Jun. 25, 2004
• Offline.
Forum Stats
Member
Level 16
Melancholy
Response to As: Rgb 2006-07-13 12:56:57

Reading through it, it seems more like an introduction to Hexadecimal than an actual use of RGB in Flash.

Still, sound theory.

...

Cybex
Cybex
• Member since: Mar. 4, 2005
• Offline.
Forum Stats
Member
Level 20
Blank Slate
Response to As: Rgb 2006-07-13 13:00:06

At 7/11/06 02:41 PM, Snubby wrote: What is RGB?
RGB stands for Red Green Blue. It is how colours are made on your computer. In real life, there are 3 primary colours; yellow, blue and red. Combining these colours can make any colour. On a computer, there are red, green and blue. Similarly, combining these colours can make any colour.

I'm ashamd of you. Red, yellow and blue are only primary colours with paint. The primarey colours of light are red, blue and green which is why those are the colours computers use. Tut tut!

KaynSlamdyke
KaynSlamdyke
• Member since: Jun. 25, 2004
• Offline.
Forum Stats
Member
Level 16
Melancholy
Response to As: Rgb 2006-07-13 13:04:27

At 7/13/06 01:00 PM, Cybex wrote: I'm ashamd of you. Red, yellow and blue are only primary colours with paint. The primarey colours of light are red, blue and green which is why those are the colours computers use. Tut tut!

I think he was reffering to paints. Interestingly, Black and White are also primary colours in paint as well.

learn something new every day with Dr Kayn...

...

Cybex
Cybex
• Member since: Mar. 4, 2005
• Offline.
Forum Stats
Member
Level 20
Blank Slate
Response to As: Rgb 2006-07-13 13:12:08

At 7/13/06 01:04 PM, KaynSlamdyke wrote:
At 7/13/06 01:00 PM, Cybex wrote: I'm ashamd of you. Red, yellow and blue are only primary colours with paint. The primarey colours of light are red, blue and green which is why those are the colours computers use. Tut tut!
I think he was reffering to paints. Interestingly, Black and White are also primary colours in paint as well.

learn something new every day with Dr Kayn...

Why would he reffer to paints when we use light much more often than paints and sinse computers use light to put forth an image wouldn't it be much more sensible to reffer to light than paint?

KaynSlamdyke
KaynSlamdyke
• Member since: Jun. 25, 2004
• Offline.
Forum Stats
Member
Level 16
Melancholy
Response to As: Rgb 2006-07-13 13:16:40

At 7/13/06 01:12 PM, Cybex wrote: Why would he reffer to paints when we use light much more often than paints and sinse computers use light to put forth an image wouldn't it be much more sensible to reffer to light than paint?

Because more people I know have passed first year Art than fifth year Science

if I ask random person A on the street what the primary colours are, most of them are going to say Red, Yellow, Blue (if they don't try to hit me on the head with a bottle). Only the ones that mess with computers, televisions or understand physics and/or advanced colour theory in art will turn arround and say RGB - and then they'll admit that yellow's far more useful in painting.

...

Cybex
Cybex
• Member since: Mar. 4, 2005
• Offline.
Forum Stats
Member
Level 20
Blank Slate
Response to As: Rgb 2006-07-13 13:24:37

At 7/13/06 01:16 PM, KaynSlamdyke wrote: if I ask random person A on the street what the primary colours are, most of them are going to say Red, Yellow, Blue (if they don't try to hit me on the head with a bottle). Only the ones that mess with computers, televisions or understand physics and/or advanced colour theory in art will turn arround and say RGB - and then they'll admit that yellow's far more useful in painting.

Ok, but primary colours in paint aren't very relevant to a tutorial about how computers use light. He was making it out to seem that rgb was just being used as an alternative to the real primary colours instead of rgb being the primary colours.

Jovatov
Jovatov
• Member since: Apr. 26, 2004
• Offline.
Forum Stats
Member
Level 16
Blank Slate
Response to As: Rgb 2006-07-13 13:28:56

Well this was usefull, I now know where those numbers/letters come from, thanks.

authorblues
authorblues
• Member since: Jun. 21, 2005
• Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to As: Rgb 2006-07-13 13:32:28

At 7/13/06 01:00 PM, Cybex wrote: I'm ashamd of you. Red, yellow and blue are only primary colours with paint. The primarey colours of light are red, blue and green which is why those are the colours computers use. Tut tut!

primary colors of light are cyan, yellow, and magenta
thats why its called the CYMK model (K for key, or black)

Cybex
Cybex
• Member since: Mar. 4, 2005
• Offline.
Forum Stats
Member
Level 20
Blank Slate
Response to As: Rgb 2006-07-13 13:36:54

At 7/13/06 01:32 PM, authorblues wrote:
At 7/13/06 01:00 PM, Cybex wrote: I'm ashamd of you. Red, yellow and blue are only primary colours with paint. The primarey colours of light are red, blue and green which is why those are the colours computers use. Tut tut!
primary colors of light are cyan, yellow, and magenta
thats why its called the CYMK model (K for key, or black)

What? I thought they were secondary colours? I didn't know about k though.

Have i been lied to my whole life?

I thought black wasn't even a colour, but a lack of colour.

pillowbasher
pillowbasher
• Member since: May. 11, 2005
• Offline.
Forum Stats
Member
Level 34
Blank Slate
Response to As: Rgb 2006-07-13 13:41:04

thanx i did learn something, but...where was the action script

KaynSlamdyke
KaynSlamdyke
• Member since: Jun. 25, 2004
• Offline.
Forum Stats
Member
Level 16
Melancholy
Response to As: Rgb 2006-07-13 13:42:58

...

dELtaluca
dELtaluca
• Member since: Apr. 16, 2004
• Offline.
Forum Stats
Member
Level 20
Blank Slate
Response to As: Rgb 2006-07-13 15:22:04

wrong, hexadecimal is just a number base, it doesnt have to be 6 digits you can have any number of digits you want, 0x0000ff === 0xff === 255

with bitmapdata you will often use ARGB colour, 0xAARRGGBB, for example, 0x80ff8000 would be a half transparent orange

dELtaluca
dELtaluca
• Member since: Apr. 16, 2004
• Offline.
Forum Stats
Member
Level 20
Blank Slate
Response to As: Rgb 2006-07-13 15:24:35

also, adding the same amount to each RGB channel, does not just make it brighter (or darker for subtraction) it also changes the pigment itself, to properly change ONLY brightness, you have to MULTIPLY each channel by the same ammount, so that the channels are in the same ratio, same pigment

liam
liam
• Member since: Dec. 11, 2004
• Offline.
Forum Stats
Member
Level 22
Blank Slate
Response to As: Rgb 2006-07-13 16:34:38

This is a shoddy tutorial, you just show some hex colours and say what there physical colour is =\

Sup, bitches :)

Snubby
Snubby
• Member since: Dec. 4, 2004
• Offline.
Forum Stats
Member
Level 21
Game Developer
Response to As: Rgb 2006-08-25 12:09:47

Well, apparently I striked on some of the names, but as for the actionscript aspect that doesn't really matter to me. If I included the actionscript portion of RGB like setTransform and stuff, the lesson would be HUGE. If somebody comes in and tries to learn how to write RGB here, they will. But if I added a whole lot of other stuff, I think that other stuff could serve as a different topic because this would be too long.