As far as I remember (from early 2010's), the story I am looking for was published in a colorful children's book with a long title. The book narrated a story (in English) about a young boy trapped in a city surrounded by giant walls and governed by an evil Mayor who used a machine with a chimney that removed and burned the dreams from the minds of each of the inhabitants in order to power the city with the fire produced. Due to the latter, the city was bland and grey.
The boy, who apparently was unaffected by the machine, wanted to fight against that. He used paint (I think) to make graffiti on the walls of the city trying to bring color, but he was reprimanded by the evil Mayor. Then, the boy finds a magic hat in a basement of his school. The hat was a kind of amplifier of the dreams and imagination of its wearer. When the boy put the hat on his head, he imagined a big red bird that flew and filled the basement with colors. Finally, the boy climbed the chimney and put the hat on top of it making the smoke to turn into a massive cloud of colors, making the machine explode and freeing the city from it. At the end (I am almost sure) the Mayor is thrown out of the city, and everyone lived happily ever after with their colorful dreams.
I remember mostly blurry colors, mainly baby blue and red. The boy had blonde hair. I remember him walking among greyish silhouettes of sad people, I believe. The Mayor was a fat guy in a dark suit with a black top hat. The magic hat looked like a Roman helmet with a red feather plume. People sleeping behind their bedroom windows with their dreams being sucked. The chimney looked like one of those rotating barber shop cylinder with red, blue and white color (thanks to @Kitkat for asking about illustrations).