And left about 100 of them with parliamentary democratic governments that were able to join the UN after they peacefully left, many have excellent relations with the UK today. Compare it to the German or Belgian management of their overseas possessions, or of France hanging on to Vietnam. The Brits confined themselves to cold war shit like fighting the communist insurgents in the post war. The fact is Britain wanted out of the empire game since before the second world war and was converting itself into an economic empire like the USA, which took over from them.
This is the 20th century we are dealing with, the 18th and 19th centuries were a different world and this century is shaping up to see the last of the empires fall, those would be Russia and China in today's world. All in all, of the imperial powers, the brits exited the stage most gracefully. The UK was also an evolving liberal democracy and along with the inclusion of more groups in society and more rights, goes the rule of law and equality under it and that in the end does not allow for imperialism.