By a decree issued on 22 April 1821 ahead of his departure from Brazil to Portugal, King John VI appointed his firstborn son and heir, Prince Pedro of Braganza, the Prince Royal of the United Kingdom, as Prince Regent of the Kingdom of Brazil, with delegated powers to discharge the "general government and entire administration of the Kingdom of Brazil" as the King's placeholder, thus granting the Kingdom of Brazil a devolved administration within the United Kingdom.
On 8 September 1822, in the first day after the Proclamation of Independence, Prince Pedro issued a decree to adopt for the Kingdom of Brazil a new flag and coat of arms, replacing the Portuguese colours, then white and blue, with new colours, green and yellow (green was chosen for its association with the House of Braganza, Pedro's dynasty; yellow was chosen as it was the colour of the House of Habsburg, in which Pedro's wife, Leopoldina, was born; the new national colours therefore honoured the Royal couple that led Brazil at the foundation of its independence); those new symbols would later pass to the Empire of Brazil when it was founded on 12 October 1822. The new, post independence symbols, replaced the original flag of the Kingdom of Brazil (a golden armillary sphere on a blue field) and its original coat of arms (a golden armillary sphere with a blue background in the interior of the sphere), that had been designed in 1815. Of course, after independence, upon the adoption of the new flag and coat of arms on 8 September 1822, the coat of arms of the United Kingdom of Portugal, Brazil, and the Algarves, adopted in 1815 (featuring a juxtaposition of the traditional coat of arms of Portugal and the Algarves with the original coat of arms of the Kingdom of Brazil in the background, surmounted by the royal crown), also ceased to be used.
As per one of the clauses of the Treaty of Rio de Janeiro, King John VI of Portugal and the Algarves, formerly King John VI of the United Kingdom of Portugal, Brazil, and the Algarves, was granted the personal title of titular Emperor of Brazil, thus having stayed monarch of Brazil, in title, until his death in 1826.