An improved particle swarm optimization method is proposed for the design of ultra-thin diffractive optical elements (DOEs) enabling multicolour beam shaping functionality. We employ pre-optimized initial structures and adaptive weight strategy in the algorithm to achieve better and identical shaping performance for multiple colours. Accordingly, a DOE for shaping light from green and blue LEDs has been designed and fabricated. Both experiment and numerical simulations have been conducted and the results agree well with each other. 15.66% average root mean square error (RMSE) and 0.22% RMSE difference are achieved. In addition, the parameters closely related to the performance of the optimization are analysed, which can provide insights for future application designs.