Color segmentation is widely used for recognizing the visual markers in a robotic tracking system. In our contribution, we propose a new method for color segmentation by incorporating differential evolution algorithm and connected component labeling to autonomously preset the HSV threshold of visual markers; then autonomously change the HSV threshold according to the ambient light during the tracking process. To evaluate the effectiveness of the proposed algorithm, a ROBOTIS OP2 humanoid robot is used to conduct the experiment, where five most commonly used color including red, purple, blue, yellow, and green in visual markers are given for comparisons.