The invention discloses a colorful printing mechanism of a 3D printer. The colorful printing mechanism of the 3D printer is composed of printing cooling fans, a fan support, a temperature control fusion extrusion component, a fixing plate, feeding pipes, four-color feeding motor devices, a colorful material extruding nozzle cooling fan and a colorful material extruding nozzle. The 3D printing mechanism further comprises a microprocessor control device, an X-axis moving device, a Y-axis moving device, an X-axis hierarchical moving module, a Y-axis hierarchical moving module, a 3D color module, a hierarchical decomposition module, a four-color segmentation value calculating module and a four-color feeding speed value generating module. By the adoption of the colorful printing mechanism, four standard colors are adopted, the four-color feeding motor devices control the feeding ratio of the four standard colors so as to achieve the purpose of making different colors through mixing, a user just needs to buy the consumables of cyan, magenta, yellow and black, and colorful objects in any shape can be directly generated from computer graphic data. Therefore, the production period of products is greatly shortened, the production efficiency is improved, and the manufacturing cost is lowered.