How do you apply colored sugar just to the raised image on a cookie
Basically, there are two options:


Use a stencil. 
This means, your design can be only slightly raised (or not at all), because the sugar will create a 3D illusion. There are plenty  of examples online, here is one from Martha Stewart (in honour of upcoming St. Patricks Day). This can be done befor baking or afterwards by sugaring an image stenciled with thin icing.
Dip the cookie upside down.
You will need a rather distinct raised image for this. Dip the cookie upside own into a bowl/plate of sugar, making sure to touch the surface only with the raised parts. Depending on your dough you might have to use some water first to make the sugar stick better. You will need a rather thick and well-cooled cookie that can keep its shape while handling. 
If you want to decorate baked cookies, brush very little thin icing on the raised part, then dip. Make sure to use the absolute minimum of icing, because otherwise it will start running down either when turning the cookie or while drying, taking the sanding sugar with it in the worst case...