+#define MAX_MODEL_NAME_LEN (256 - (DEVINFO_MODEL_LEN + 1) - (OSX_VER_LEN + VER_NUM_LEN + 1) - (MODEL_COLOR_LEN + MODEL_RGB_VALUE_LEN + 1))
+
+mDNSlocal mDNSBool getModelIconColors(char *color)
+{
+ mDNSBool hasColor = mDNSfalse;
+ mDNSPlatformMemZero(color, MODEL_RGB_VALUE_LEN + 1);
+
+#if !TARGET_OS_EMBEDDED && defined(kIOPlatformDeviceEnclosureColorKey)
+ mDNSu8 red = 0;
+ mDNSu8 green = 0;
+ mDNSu8 blue = 0;
+
+ IOReturn rGetDeviceColor = IOPlatformGetDeviceColor(kIOPlatformDeviceEnclosureColorKey,
+ &red, &green, &blue);
+ if (kIOReturnSuccess == rGetDeviceColor)
+ {
+ // IOKit was able to get enclosure color for the current device.
+ hasColor = true;
+ snprintf(color, MODEL_RGB_VALUE_LEN + 1, "%d,%d,%d", red, green, blue);
+ }
+#endif // !TARGET_OS_EMBEDDED && defined(kIOPlatformDeviceEnclosureColorKey)
+
+ return hasColor;
+}
+