Hey guys,

So, as part of my Advanced Higher Computing project I need to create the background the same color as an image on screen. The color is green, but the built in TB color "green" isn't the same as the one I've used.

The code I used is

'SET COLOR MIX red, green, blue'

which is how it appears in the trueBasic manual.

The problem I am having is that the 'red, green, blue' part has to be 1, 0 or fractions between 1 and 0. i.e. 1/3.

I was wondering if there is a way to create colors using hexadecimals as this would make it way easier.

Many thanks,

D

### Hi, In order to find out the

Hi,

In order to find out the r,g,b value of particular pixel on the screen you need to use the built-in (but undocumented routine):

where x,y are the pixel co-ordinates of the screen pixel
where r is the "red" component (a decimal value between 0 and 255)
where g is the "green" component
where b is the "blue" component

You can find out the location of a point on the screen with GET MOUSE x,y,button
If you click on a point on the screen GET MOUSE will report back the x,y co-ordinates.

Once you have the r,g,b values you can then use these in SET COLOR MIX(n) r,g,b
where n can be any number (I would recommend numbers greater than 16). Now you have created a new color number that is exactly the same color as the green background you need. Now you can use:
SET BACKGROUND COLOR n

Regards
Big John

### Thanks Big John, This did

Thanks Big John,

This did work, and returned a result similar to 'r = 0, g = 0.467456, b = 1.464574e-4'

The problem is the result of 'b' as I couldn't implement it into the SET COLOR MIX command.

### Hi, The result for

Hi,

The result for b=1.464574e-4 means it is a very small number (the decimal point needs to be moved left 4 times i.e. .0001464574)

I doubt if you could tell the difference between the value above and b=zero

Regards
Big John

### It did work, it was just the

It did work, it was just the way I used the set color mix. Thanks a lot John :)