Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is rgb formula for a gradient going from white to blue?

I want to have a button that has numbers in the range 0 ... 255. I'd like the color of the button to be white when it's zero and blue (RGB = (0,0,255)) when it is 255. How can I accomplish this? At first I tried to make it RGB = (0,0,0) in the beginning, but it will only make it black.

How can I accomplish this?

like image 892
devoured elysium Avatar asked Nov 11 '09 07:11

devoured elysium


2 Answers

Simple linear interpolation between white (255,255,255) and blue (0,0,255) will do.

like image 65
ndim Avatar answered Oct 02 '22 00:10

ndim


A gradient from blue to white would start with:

0,0,255

with values of the R and G increasing at the same rate: 1,1,255 ... 10,10,255 ... 255,255,255

The colors between the 2 will start to appear pastel blue, then greyish blue.

like image 20
webguydan Avatar answered Oct 02 '22 01:10

webguydan