Since tactile perception and robotic manipulation play important roles in human survival, we propose a new method for developing robotic tactile sensors based on the structural colours of Morpho menelaus (a kind of Morpho butterfly). The first task is to fabricate a flexible bioinspired grating with a similar microstructure to the wings of Morpho menelaus using the transfer technique, onto the surfaces of polydimethylsiloxane (PDMS) films. The second task, depending on the angle of diffracted light, is to integrate the flexible diffraction grating with a polychromatic light source and a CCD camera, and then predict the position and magnitude of the contact force caused by a change in the diffraction pattern. The final task is to set up an experimental calibration platform and a marker point array with an interval of 1 mm for an image processing algorithm and a deep learning method to establish the relationship between the contact point position, and the magnitude of the force and diffraction pattern. The results showed that this tactile sensor has high sensitivity and resolution, with the position of the contact force of 1 mm. This practical application of the UR-5 manipulator verifies the feasibility of the prototype as a tactile sensor. This tactile sensing method may be widely used in robotics by miniaturising the design.