Short answer
There are three approaches that reliably work: white or off-white trim for contrast, trim in the same colour as the walls for a seamless look, and trim in a deeper version of the wall colour to frame the room. What rarely works is a white from a different range than the walls, which reads as a mismatch rather than a contrast.
Trim occupies a small area but runs continuously around the room at eye level and below, so it functions as a line rather than a surface. A line either divides the room into panels — the contrast approach — or disappears — the tonal approach. Both are coherent. The failure case sits between them: a trim colour close enough to the walls to look like an attempt at matching, but different enough to read as a failed one. Whites are where this happens most, because most people treat 'white' as one colour when it is dozens.
Contrast trim to define and traditionalise, matching trim to simplify and enlarge, deeper trim to frame. Pick one before choosing any colour.
A warm wall colour needs a warm white. Using a brilliant white against a warm wall is the mismatch described above, and it is the commonest woodwork mistake.
Walls in matt, woodwork in eggshell or satin, same colour. The trim gains the durability it needs and the boundary still disappears.
A radiator painted to match the wall or trim disappears; left in factory white against a coloured wall it becomes one of the most visible objects in the room.
Internal doors are a larger area than skirting and can take a different treatment — a deeper colour on the doors with lighter architrave is a common and successful variation.
Use strongly contrasting dark trim carefully in a small or low-ceilinged room — it draws a hard line around the space and can make it feel smaller, which is the opposite of the framing effect intended in a larger room.
How to test it
Paint a sample board with the wall colour and the trim colour meeting along one edge, and hold it against the existing skirting. The join is what you are judging, not either colour on its own.
Undertone
White trim is where undertone mismatches are most visible, because there is nothing else in a white to look at. Test the trim white against the wall colour, not against the old trim.
Lighting
Trim runs along the base of the wall where light is weakest and along door frames where it is strongest, so the same trim colour is seen under a wider range of light than the walls are.
Finish
Woodwork is touched, cleaned and knocked, so it needs a more durable finish than walls. Eggshell and satin are the usual choices; full gloss is traditional and very durable but shows every imperfection in the underlying woodwork.
Whatever a calculation or a chart says, view a physical sample in the actual location before committing to a large surface.
Colourwise editorial guidance, drawn from conventional decorating practice and from the physical behaviour of light and surfaces described in the linked lighting and finish guides. Not manufacturer advice — always follow the specific instructions supplied with any product you use.