Apple's MagSafe cases don't detect colour when connecting to the iPhone. Instead, they use magnets for alignment and attachment, just like other MagSafe accessories. The colour detection feature you are referring to is related to the iPhone's software, which can recognize the colour of the case once it's attached.