The short answer
Yes. Ceylon, now Sri Lanka, was a British colony. The British took control of the island’s coast in 1796, Ceylon became a crown colony in 1802, and the whole island was under British rule after 1815. It stayed a British possession until it became independent as the Dominion of Ceylon on 4 February 1948.
Before the British
Portuguese traders arrived in the early 1500s and held parts of the coast. The Dutch later took over those coastal areas, and they held them from the mid-1600s until the British took them in 1796. The interior, the Kandyan Kingdom in the central hills, remained independent for longer.
The British takeover
Britain took the Dutch coastal territories in 1796. Ceylon became a crown colony in 1802, which meant it was ruled directly under the Crown. In 1815 the Kandyan Kingdom was brought under British rule after a defeat, so the British then controlled the whole island.
Life as a crown colony
A governor represented the Crown and ran the island, with the Colonial Office in London overseeing policy. Over time, councils were reformed to include more local members. In 1931 the Donoughmore reforms created a state council elected by a broad franchise, which was an important step toward self-government.
The Second World War
Ceylon was still a British colony during the Second World War. Like other colonies, it was at war because Britain was at war. The British Army, the Royal Navy and the Royal Air Force used the island as a base, and Japanese carrier aircraft raided Colombo and Trincomalee in April 1942. Other British colonies also sent local men to the war, Cyprus among them, and that story is told in cypriot soldiers in ww2.
The road to independence
After the war, a commission led by Lord Soulbury reviewed the island’s constitution in 1944 and 1945. The result was a path toward independence within the Commonwealth. On 4 February 1948, Ceylon became the Dominion of Ceylon, and D. S. Senanayake became its first prime minister.
The republic
Ceylon was a dominion for a little over two decades. In 1972 the country became the Republic of Sri Lanka, ending its ties as a dominion and adopting the new name.