I believe you are referring to the juvenile novel The Runaway Robot. (1965) published with Lester del Rey's byline, but was actually ghost-written by Paul W. Fairman based on an outline by del Rey.
The giveaway was the color vision. In Runaway Robot, the robot get color-sensing eyes, and springs that as a surprise on the kid who's his best friend "Say, Paul, that's a nice red shirt you're wearing this morning."
The other part that matches is that the robot is shutoff at one point trying to 'fake' that he is a 'rogue' robot. The police/law enforcement/mp, doesn't believe Rex is truly rogue and simply walks up and shuts him off rather than destroying him via ray blaster or some such type weapon. That part is on Mars which matches what you remember.
You may also remember another scene in which the robot, Rex, plays chess with the spaceship captain helping him reach Paul (after having stowed away). No surprise, Rex beats the pants off the captain who mutters something along the line, "Who says they're going to invent robots that take over the solar system. They already have!"
Some other covers exist here if that helps ring a bell.
Hope this helps.
•The robot named Rex had been bought as a companion for Paul when the Simpsons decided to pioneer on Ganymede, a moon of Jupiter...a rough, dangerous satellite where a small boy needed a strong, intelligent robot to protect him. By the time Paul is sixteen, they are inseparable. Robots, of course, have a personality leeway that gives each one a certain individuality within its pattered capacities — and Rex had a wonderful personality, with a logic quotient that allowed him to reason. But when the Simpson family is ordered back to Earth and Paul refuses to part with Rex, the robot plans to stow away on a spaceship to Earth — no easy feat, even for a robot with Rex's abilities. Thrilling chases in skimmers, through spaceports, and over the deserts of Mars are just the start of the problems for The Runaway Robot!