The Legend of the Purple Hairpin is written by Tong Dik Sang, a famous Cantonese opera dramatist, who based it on a Tang Dynasty novel, The Story of Huo Xiaoyu, and the classic Yuan Dynasty play, The Legend of the Purple Flute, by Tang Xianzu. This is another of Tong Dik Sang’s operas which eulogize the theme of love and devotion.
In the Tang Dynasty, a young scholar, Li Yi, has travelled to the capital, Changan, to take the national civil examination. During his stay in the capital, he is told that a pretty young woman who loves to dress in purple admires his poetry greatly. She is a courtesan named Huo Xiaoyu. He hopes that he will have a chance to meet her. On the evening of the Lantern Festival*, he and his friends roam around the city to enjoy the magnificent lanterns and the beautiful maidens strolling by as they look for the one dressed in purple.
Li Yi by chance picks up a purple hairpin that belongs to Huo Xiaoyu, who falls in love with him at first sight. She gives him the hairpin as a token of her love for him. Li Yi’s close friend persuades him to go to her family to ask for her hand. Xiaoyu’s mother is eager to have a talented son-in-law to restore their family fortune and agrees to the marriage proposal. The couple have the informal wedding that same night.
The next day after the wedding, the examination result is announced. When Li Yi is awarded the first place in the examination, he and his wife, Xiaoyu, are overjoyed with this good news. However, good fortune soon turns into a disaster for a high court official’s daughter has a chance meeting with Li Yi on the night of the Lantern Festival and she too falls in love with him. She begs her father to arrange a marriage, so she can marry Li Yi. When Official Lo proposes the marriage to Li Yi, he refuses because he considers himself married to Xiaoyu. His refusal angers Official Lo, who then sends Li Yi to the frontier as a reprimand and so forces the newly-wed couple to separate from each other.
While Li Yi is away for three long years without any means of correspondence with his wife, Xiaoyu’s livelihood becomes harder as days go by. She stops being a courtesan after the marriage, so she has to rely on pawning her jewellery to support her family and Li Yi’s downtrodden friend. When Li Yi returns from his frontier posting, Official Lo detains him in his house in order to force the young man to marry his daughter. Li Yi is told if he refuses, Official Lo will expose his scheme against the state. If this happens not only he but his family will also be punished. Li Yi still rejects the proposal and tries to kill himself, but Official Lo continues with the wedding preparation.
Meanwhile, Xiaoyu is forced to sell off her precious purple hairpin. She then comes to know that the Lo family has bought the hairpin for their daughter’s wedding to Li Yi. Helpless and heartbroken, Xiaoyou goes to pray in the temple, where she accidentally meets a mysterious person in a yellow robe. He helps Li Yi to see Xiaoyu again, but Li Yi is taken by force back to the Lo family. At the mysterious man’s suggestion, Xiaoyu goes to Official Lo’s mansion to demand the release of her husband. At her arrival, the Lo household is busy preparing for the wedding ceremony. Her presence infuriates Official Lo, who devises a scheme to kill her right in the main hall.
In the nick of time, the man in the yellow robe appears. He reveals his true identity, that of the Fourth Prince. He is under the Emperor’s instructions to investigate Official Lo for treason. Now that he has the needed evidence, he arrests Official Lo. In the end, Li Yi’s and Xiaoyu’s devotion and love for each other are justly rewarded and they are able to be formally married.