I share some code that you can use in Processing applications to create linear and radial gradients. These gradients can be used with or without dithering, which creates a very smooth appearance.