Zoom in as far as you are comfortable on the area that you would like to shade on an image. This helps you more easily pick the color that you want to use.
Locate the eyedropper tool. Typically, it is a default tool in the toolbox of a digital art program and is a button with an image of a small eyedropper.
Select the eyedropper tool, then click the area that you want to shade. This pulls the color from a pixel in the area. If you are working with a photograph, you may need to try several times before you get a color that you are satisfied with because photographs may have several differently colored pixels in an area.
Create a new layer and paint some of the selected color on the new layer using a hard, opaque brush.
Look for the color box that displays the color of your current brush. Click it to open a dialogue box, which will allow you to select specific colors. Choose several different colors that are lighter and darker than your selected color but the same general hue. Paint the dark colors on one side of the color already painted on your new layer and the light colors on the other side. This creates a rough gradient.
Create a smoother gradient by blending the colors together with a blending tool. Select the layer that you want to shade, then use the eyedropper to select the colors you want from the gradient and shade the object in your painting. Painting this way helps keep your colors fresh; colors in a digital painting can become muddy from shading and blending just as those in a physical painting can.
Delete the layer with the gradient after you have finished.