A novel colorimetric logic system based on the aptamer-cross-linked colloidal crystal hydrogel (CCH) was developed. With the input stimuli of Hg(2+) and Ag(+), the CCH displayed shrinking response and colour change corresponding to the logical "OR" and "AND" gate. The visualization of the logic output signals is realized.