What color trim goes with white walls?

With white walls you have three honest options for trim: the same white in a glossier sheen (continuous, gallery-like), a warmer or cooler white one step away (subtle depth), or a genuine contrast (black, deep green, or wood tone) that turns doors and windows into architecture. The mistake is an accidental mismatch: two whites with clashing undertones that read as “dingy” rather than “designed.”
Same color, different sheen
The safest sophisticated move: walls in matte or eggshell, trim in the same color at satin or semi-gloss, where the sheen difference catches light along the molding profile and does the articulation work that color contrast would otherwise do. This is the standard in galleries and new builds because it never clashes: undertones are identical by construction.
Contrast trim: when and which
Black or near-black trim frames windows like eyeglass frames: strong, graphic, best where the windows deserve attention. Deep green or navy trim against warm white walls is the current designer move for period homes; it flatters both brass hardware and oak floors. Stained or clear-sealed wood trim warms a white room instantly but commits you to its specific wood tone everywhere in the room.
Whichever direction, carry it consistently across baseboards, casings, and crown. Mixed trim colors in one room read as unfinished repairs.

Undertones: the whole ballgame
Whites carry hidden bias toward pink, yellow, green, or blue. Two whites with different biases side by side make each other look dirty. If you are not matching sheen-on-same-color, test the pair together: photograph the room and assign wall white and trim white as separate surfaces in the preview, then look at the junction line. That line is where the undertone fight happens. A per-surface render shows you that line before the painter arrives.
Questions
Should baseboards match door casings?
Yes, in nearly every room. Baseboards, casings, and crown form one continuous frame, and breaking their color reads as a mistake rather than a choice.
Is pure bright white ever right for trim?
With cool-white or colored walls, yes. Against warm antique whites it usually looks bluish and stark; pick a white that shares the wall’s warmth.