Food coloring can add a fun, festive visual element to many dishes, but it's best suited for liquids and pastes where the coloring can be mixed in, rather than solid food items. Pasta, however, can be colored with food coloring by means of the boiling water, since the water permeates the pasta during the cooking process.
Measure just enough water to cover the pasta you're cooking in order to conserve food coloring. If using small, shaped pasta pieces like penne, a good way to do this is to place the dry pasta in the cook pot and observe how deeply it fills up. Remove the pasta and fill the pot with roughly enough water to reach just past the the line that the pasta reached (don't worry, it doesn't need to be exact). If using spaghetti or something similarly shaped, fill the pot with enough water to be able to submerge the pasta.
Add food coloring to the pasta water. You will want considerably more coloring than just the few drops you'd need to color the water, since the pasta will take only as much color as it gets from absorbing the colored water, making it paler. Start with about three times as many drops of coloring as it takes to color the water the shade you want. Stir thoroughly.
Test the water color using a strip of paper towel. Dip a small piece of clean, white paper towel into the water and observe what color it becomes when you pull it out again, then wring away the excess water with your fingers. This is a pretty good indication of what color the pasta will become when cooked in that water.
Boil the pasta in the colored water as normal. Cook according to the instructions on the pasta's package using the colored water.