[futurebasic] Re: Single number color?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : August 1998 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Mon, 10 Aug 1998 09:28:20 +1200
>Is there an existing (and simple) method of using a single number to
>represent color?
>Similar to the FB COLOR=_zBlack but with 256 values or more?

Pierre,
The toolbox calls COLOR2INDEX and INDEX2COLOR supply what you want.
Here is a short demo. Note: the result of FN COLOR2INDEX depends on the
number of colours displayed on your monitor. In 256 colour mode the result
is a number 0-255.


COMPILE _dimmedVarsOnly
DIM colorNumber&,plotRGB.6

WINDOW 1

plotRGB.green%=10000
plotRGB.blue%=30000
plotRGB.red%=9000
colorNumber&=FN COLOR2INDEX(plotRGB)
PRINT colorNumber&

plotRGB.green%=0
plotRGB.blue%=0
plotRGB.red%=0
CALL INDEX2COLOR(colorNumber&, plotRGB)
PRINT  plotRGB.green%,plotRGB.blue%,plotRGB.red%

DO
UNTIL FN BUTTON


Robert