RGB Colours

This is a discussion on RGB Colours within the A Brief History of Cprogramming.com forums, part of the Community Boards category; I am wondering why colour editing paramaters are based on this RGB, why is it not Red, Yellow, Blue, i.e ...

  1. #1
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,422

    RGB Colours

    I am wondering why colour editing paramaters are based on this RGB, why is it not Red, Yellow, Blue, i.e the three primary colours? i sem to recall this as the electron guns in old colour TV Tube would be RGB too?

  2. #2
    Registered User
    Join Date
    Nov 2004
    Location
    India
    Posts
    515
    This might help you.
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Actually, Red Green and Blue are primary colours.

    If you want Yellow to be a primary colour, then you need to mix it with Magenta and Cyan - since those are the other primary colours you need to produce all colours.

    And looking at it, you will probably find that these are the opposites. Yellow is the opposite of Blue, Cyan is the opposite of Red, Magenta is the opposite of Green.

    The reason for all this is that there are two different ways of mix colours: Additive, where more colour means closer to white, and subtractive, where mixing more colour means closer to black. For example, 100&#37; Red + 100% Green + 100% Blue is white, 100% Cyan + 100% Magenta + 100% Yellow is black.

    So additive colours are used for CRT's and such things.
    Subtractice colour mixing is used in colour printing. As you may be aware, most colour printing is done using CMYK (K stands for blacK). The purpose of this is twofold:
    1. Black printing ink is cheaper than 3 layers of Cyan, Magenta and Yellow.
    2. It's near impossible to produce ABSOLUTELY correct Cyan, Magenta and Yellow - so you end up with "dark brown" instead of black, because the colours aren't perfect.

    Edit: PING obviously did the right thing by pointing to a Wiki page describing it, rather than writing down the whole story (less concise anyways).
    --
    Mats
    Last edited by matsp; 04-18-2008 at 04:45 AM.
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  4. #4
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,422
    hehe, ok, i still don't see why it was neccesary to use green though, my point being green is a mix of yellow and blue.
    you can't mix any two other colours to make a red, a blue or a yellow, well certainly not using paint in the real world, so they are the real primary colours no?
    i like the image seperated into components on the wiki link...
    Last edited by rogster001; 04-18-2008 at 04:57 AM. Reason: can > can't

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You can ONLY make green from mixing Yellow and Blue in a subtractive colour mixing.

    When you use "paints" or "ink", you are "taking away" colour when mixing something in.

    When you use light (such as exciting a phosphorous cell or lighting a cell on a CRT/LCD panel), then the colour is added together, so adding Green and Red together makes Yellow (that is, by taking away Blue from white, which is what Yellow ink does when you apply it to white paper - it reflects all colours except blue).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,537
    That sounds like stuff in the physics book I never took interest enough in to learn :|
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,422
    super stuff that mate, i like it! missed that bit in me physics book too..erm.....sure you could teach that to kids in primary(;->) school though, then they would not be spenidng rest of their days thinking you can't make yellow by mixing other colours!

  8. #8
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Well, I doubt it was covered in my Physics education either, but I worked with a small company doing high-level pre-printing processing, such as producing the films for magazines and papers, so I had to learn the reasons behind conversion of colours. [Such as RGB -> CMYK].

    --
    Mats
    Last edited by matsp; 04-18-2008 at 06:33 AM.
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  9. #9
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    Quote Originally Posted by rogster001 View Post
    super stuff that mate, i like it! missed that bit in me physics book too..erm.....sure you could teach that to kids in primary(;->) school though, then they would not be spenidng rest of their days thinking you can't make yellow by mixing other colours!
    Go to a better school, they do teach it, at least they did in my school. Peoria public schools are better than most private schools, or at least they were when I attended.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  10. #10
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,537
    Quote Originally Posted by matsp View Post
    Well, I doubt it was covered in my Physics education either, but I worked with a small company doing high-level pre-printing processing, such as producing the films for magazines and papers, so I had to learn the reasons behind conversion of colours. [Such as RGB -> CMYK].
    I remember the book covering a lot of about colours, but fortunately, I wasn't required to learn it. Just a lot of other stuff!
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #11
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    If you get GIMP (or a popular equivalent which costs $$$), there are many different ways of editing colours, not just RGB.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  12. #12
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Salem View Post
    If you get GIMP (or a popular equivalent which costs $$$), there are many different ways of editing colours, not just RGB.
    True enough, they support RGB, CMY/CMYK as well as for example YUV.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  13. #13
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Portugal
    Posts
    7,436
    And HSL
    The programmer’s wife tells him: “Run to the store and pick up a loaf of bread. If they have eggs, get a dozen.”
    The programmer comes home with 12 loaves of bread.


    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  14. #14
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738
    >I am wondering why colour editing paramaters are based on this RGB

    A committee a long time ago chose these 3 colors because these best accommodate the retina of the human eye. They stimulate the cones in the retina in certain ways (like the Wikipedia article stats which PING linked to).

    RGB are the primary colors of light, and CMY are the primary colors of pigment (as has also been mentioned). Red, yellow, and blue are not primary colors by any means, even if they teach this in grade school. The proper primary colors of pigment are cyan, magenta, and yellow.

    Here is a diagram that shows the full color chromaticity diagram:

    http://en.wikipedia.org/wiki/Color#R...pectral_colors

    All the pure colors are on the outside.
    My Website

    "Circular logic is good because it is."

  15. #15
    Ecologist
    Join Date
    Aug 2001
    Location
    Utah.
    Posts
    1,291
    Red, yellow, and blue are not primary colors by any means, even if they teach this in grade school.
    Not true in the slightest...

    Red, Yellow and Blue are the primary colors in color theory.
    They're the colors that can't be created by mixing any other
    colors on a palette. RYB being taught as primary colors isn't
    some attempt by elementary schools at dumbing down fact
    so their students can grasp the concepts more easily.

    CMY (and Black) are the primary colors used in color printing,
    not art. No painter has ever mixed CMY (and Black) on their
    palette. Magenta wasn't even created until the late 1800s.
    Cyan isn't even a single color; it encompasses blues and
    greens.

    So as far as art theory goes, Red Yellow and Blue are the
    primary colors.
    Staying away from General.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Converting RGB to Hex.
    By mintsmike in forum C Programming
    Replies: 2
    Last Post: 03-23-2009, 12:22 PM
  2. OpenGL: Pixel addition
    By Hunter2 in forum Game Programming
    Replies: 4
    Last Post: 12-15-2008, 01:36 PM
  3. Stopwatch program (need help!)
    By modnar in forum C Programming
    Replies: 9
    Last Post: 03-21-2004, 11:42 PM
  4. Colours in DOS box
    By denizengt in forum Tech Board
    Replies: 1
    Last Post: 09-10-2003, 06:53 AM
  5. Changing Text/Background colours for window controls ...
    By Shag in forum Windows Programming
    Replies: 1
    Last Post: 11-16-2002, 10:57 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21