Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.vssettings file (Visual Studio Settings) Color Format

I'm creating my own color scheme for Sublime text based off of a Visual Studio Theme.

The Visual Studio theme has foreground and background defined, but they are not in the standard RGB triplet. I don't know what this number means, and I was wondering how I could convert it into a RGB triplet (ie #FFFFFF) for use in Sublime Text.

Sample:

<Item Name="Comment" Foreground="0x007B7466" Background="0x02000000" BoldFont="No"/>
<Item Name="Plain Text" Foreground="0x00F3F2F1" Background="0x002A2822" BoldFont="No"/>
<Item Name="Selected Text" Foreground="0x00FFFFFF" Background="0x0064614F" BoldFont="No"/>

I've tried searching on here and google, but apparently I can't get my search terms correct to find the right answers.

like image 761
Richie Li Avatar asked Nov 04 '11 04:11

Richie Li


2 Answers

Just as an FYI the vsettings file uses BGR not RGB

like image 150
Shawn Avatar answered Oct 26 '22 22:10

Shawn


These appear, at a glance (and with some knowledge of how MS likes to handle colors) to be ARGB or XRGB DWORDs in hex form. Depending on what you're doing, though, they could be A/XBGR.

Most likely, the first two characters are alpha, then red, green, and blue. That's a pretty standard way of laying out colors, since it neatly fits in a memory register and matches texture data for a few formats.

However, some places like to reverse that, which matches other texture formats. The A/X remains at the start, then blue, green, and red.

This should be easy to test for, by providing 0x00FF0000. If blue, the BGR, if red, RGB.

It is possible that they might be using the first channel/byte as something other than alpha. Packing data into the alpha channel of a 3-channel texture is not uncommon. However, only one of the colors is 0x02..., the rest are all 0x00..., so I wouldn't this is going on (there's also a 3.5 byte color in there, so perhaps typos).

You don't need to do any conversion with these, as they are already hex (actual code hex, not the #... web stuff). To "convert" a web hex triplet, just remove the # and prepend 0x00 and you should be good. All the other characters remain the same (case shouldn't matter, though some people like uppercase as procedure).

like image 39
ssube Avatar answered Oct 26 '22 23:10

ssube