It is basically impossible to do that in home conditions.
Assuming that you are starting with the whole vegetable (or fruit, or flower...), the closest you can do is to turn it to juice. Actual extraction is almost always futile - the solvents in the kitchen are limited to fat, water and alcohol. Fat is completely out of the equation, both because it won't extract much color and because it won't taste good in a cocktail, a water extract would be inferior to a juice (which is already water-based), and for alcohol extracts, look at traditional homemade liqueurs - besides getting a lot of taste along, you will also get colors in the brownish range. Pale pinks or yellows could be possible too.
The juice method will give you a decently colored liquid, but with the caveat that you won't be able to concentrate it or preserve it. So, if you want a green cocktail, you may have to mix it with equal parts spinach juice to get a good color. Also, you will face an unpleasant tradeoff between color and texture - the more you filter the juice, the paler your color. Also, expect a shelf life of minutes to hours before the juice starts browning.
If you are really OK with something industrially produced, such as the powders Megha mentioned, you can of course try them, but then again, you could just go for industrially extracted food coloring.