There is no absolute rule for the proper trim and molding color selection for your room, but there are key elements to consider. When you get a trim and molding installed with the same colors as the ceiling, each room of your home creates a unified theme throughout your house. In addition, you can change your walls to any color that you like and use of one color on the trim and ceilings, which provides a smooth transition between each room as you travel throughout your home.
White trim and some off white colors complement any wall color, which is why is why they are so popular. White is going to lighten a strong color and help to relieve the eye visually. This works for darker hues and colors. If you are using lighter colors, the white trim is going to provide a clearer look while a bit of contrast to help create a visual effect for the room. A classic shade of white trim gives you more flexibility in wall color selection, room design & color accents for each area of your home. However you may want to bring attention to particular area of the room, which can be done by with the trim color. By altering the trim color in an area within the room, you add focus to that area or element. For example when the paint color around the fireplace or a built in bookshelves is not the same as the trim color, you provide a focus to these architectural details.
Keep this in mind next time you are looking to do some interior painting.