During the Northern and Southern Dynasties Period, there lived a famous poet and writer named Jiang Yan (江淹) in Liang dynasty.
When Jiang Yan was young, he was very brilliant in the area of literature. His poems and his essays were both outstanding, and thus he not only won the popularity among all the scholars of his time but also found himself an important position in the history of the Southern Dynasty literature.
Legend has it that someday Jiang Yang had a dream, in which he saw a handsome man came to him and said: "I'm Guo Pu (An outstanding Poet in Jin dynasty, more than one hundred years earlier than Liang Dynasty, and he was the ideal of Jiang Yan). My five-color pen has been with you for years; it is time to get it back." Before Jiang Yang said anything, the man reached his hand into Jiang Yan's pocket, taking out a colorful pen, and then disappeared. From then on, Jiang Yan lost his inspiration.
Background And Writer Comment:
The idiom of is now used to describe the case in which someone at the end of one's wits.
There is another idiom--The Pen Producing Flowers--Miao Bi Sheng Hua with similar plot with this one, but with different meaning.