Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

How do we convert a CT_COLORINDEX in ColorableItemInfo's crForeground to an RGB color in C#?

$
0
0

In a managed VS package, I am trying to resolve the valid foreground and background colors in ColorableItemInfo structures to their actual RGB color values.  When the __VSCOLORTYPE is CT_VSCOLOR, it's clear that I should call GetVSSysColorEx to get the actual color value.  But when the __VSCOLORTYPE is CT_COLORINDEX, it's not clear how to convert into the actual color. 

By looking at the value in the crForeground member when the __VSCOLORTYPE is CT_COLORINDEX, for example, I see that it always starts with 0x01 in the high order byte, and the rest of the value appears to be the index that corresponds to a value in the COLORINDEX enumeration.  By masking out that high byte, I end up with a value that appears to correspond with one of the COLORINDEX values.  Converting that value to an actual color is trivial for values such as CI_WHITE, CI_MAROON, etc., but is not as clear how to convert values such as CI_SYSPLAINTEXT_BK, etc.

I'm sure there must be one method somewhere that performs the conversion from the index to the RGB color.  I just can't seem to find that method. 

Any assistance would be appreciated.  Thanks.




Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>