You cannot get the color directly, but if you need to test your user interface to make sure your labels are highlighted correctly, you can set an accessibility label to include information such as the color or the fact that it is highlighted.
It will also improve the usability of the application, as users with impaired vision will not see the color in any case. You can then write tests to make sure at least the availability label is correct. Of course, there is a chance that the developer will make the label brighter than green and the accessibility label "yellow", but this is a common risk of using accessibility for request user interface elements.
For example, in your application code:
myLabel.text = "Draft" myLabel.color = .yellow myLabel.accessibilityLabel = "Draft (Yellow)"
source share