In JS canvas gradients are composed from linear gradient object and color stops added to it. c0deff has its own gradient objecta, that make gradients a bit easier.
First of all, gradient has to be constructed. The simplest way of constructing a gradient is this:
var background = new cdf.Gradient(grad_canvas_1,['#444', 'black', '#c0deff']);
...where grad_canvas_1 is the canvas the gradient should be drawn on