COLOR GRADIENTS: RGB Colors convert to Decimals

Hello!

I want to code color gradients for datafield background (for heartrate zones etc...)

Is there a common way to do this?

I coded a sample - which would be more easy, if there is a way to convert RGB to Decimals whithin Monkey C.

My test code:

        var fullRED    = 16711680;         // rgb(255, 0, 0)
        var darkerRED  = 16056320;         // rgb(245, 0, 0)
        var difference =   655360;          
        
        for ( i = 0; i <= 20; i ++ ) {
            dc.setColor(fullRED - i*difference, Graphics.COLOR_TRANSPARENT);
            dc.drawLine(50+i, 200, 50+i, 300);
            dc.drawLine(150-i, 200, 150-i, 300);
        }

leads to following:

That's what I want to do - but with every color and fading to black as well as fading to white.

Does anybody know a simple solution?

Thanks!