The device colour (used to?) be encoded in the serial number of the device. I don’t have a device to test on with them not officially released yet, but I imagine the solution will be similar to this:
Typical format of the iPhone SN is as follows: AABCCDDDEEF
AA = Factory and Machine ID
B = Year of Manufacturing (9 is
2009/2019, 0 is 2010/2020, 1 is 2011 and so on)
CC = Production
Week (01 is week 1 of B, 11 is week 11 of B and so on)
DDD =
Unique Identifier
EE = Color (A4=black)
F = size (S=16GB,
T=32GB)
[Source]
There is more information on old techniques here
I would like to point out however, that I expect there isn’t a supported method of getting the serial number. Assuming you’d only like to know this information so that you can customise your UI, I’d just put in a user option or ask them to select the colour of their device on first startup (or some other early point in the app-user life)