It would be a round-about way – getting the names, then using the names to get the colours, then comparing those to the Foreground Color (or whatever).
Hopefully someone else can offer more insight … but as you marked this thread as answered others may not pay it much mind so you might want to start a new thread if the method proves too cumbersome.