Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2011-12-21 23:59:54

FanOfBMS432
Member
Registered: 2011-12-21
Posts: 1

Brain challenge: allocate #00ff00 (green) to another RGB colornumber

Hi all,

I'm looking for a solution for my problem. I really hope someone can help me out / point me in the right direcion here.

The problem: an application (coded in C++) has hardcoded which colors it can use. Everything drawn by the code is green (#00FF00). The developers choose to include all combinations of FF and 00. So, red, yellow, magenta, green, etc. These one can choose from.

However, I need to have a customized color in this application (0, 255 , 191).

So the problem to solve is: I need a hex assigned value (#00FF00, green) to represent another color, but without changing this hexcode! I want this hexcode (#00FF00) to represent the color: 0, 255, 191)

So, before the app starts reading all variables and declares all constants, a want to redesign the colorpalette it uses, so whenever the hexcode #00FF00 is called, it returns the RGB value of 0, 255, 191

Any clues?
Fan

Offline

#2 2011-12-30 08:06:24

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: Brain challenge: allocate #00ff00 (green) to another RGB colornumber

Color pallettes were used many decades ago in some screen modes.
I don't think you can do this substitution likely now, but I may be wrong.


igloo myrtilles fourmis

Offline

#3 2011-12-30 08:18:34

Bob
Administrator
Registered: 2010-06-20
Posts: 10,583

Re: Brain challenge: allocate #00ff00 (green) to another RGB colornumber

hi FanOfBMS432


In many ( perhaps all ??) computer languages green is represented this way.

So I suspect it is a standard to make it easy to generate colours correctly on the screen when the code is sent to the graphics sub-routines.

So I would suggest you find a way to program the change in a variable you want so the correct colour is made rather than changing the palette.

Some sort of Look Up Table perhaps?

Bob


Children are not defined by school ...........The Fonz
You cannot teach a man anything;  you can only help him find it within himself..........Galileo Galilei
Sometimes I deliberately make mistakes, just to test you!  …………….Bob smile

Offline

Board footer

Powered by FluxBB