Levi H
Levi H

Reputation: 3586

How can I get visual studio text editor background colour?

I want to be able to get the rgb colour of the back of the text editor in visual studio so I can use it in an addin so it goes with the theme the user has set.

Upvotes: 0

Views: 440

Answers (2)

ptutt
ptutt

Reputation: 1338

This is probably what you are after: IVsFontAndColorStorage interface

http://msdn.microsoft.com/en-AU/library/microsoft.visualstudio.shell.interop.ivsfontandcolorstorage.aspx

Upvotes: 1

John Koerner
John Koerner

Reputation: 38079

If the user has modified the background font it will be stored here:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\FontAndColors\{58E96763-1D3B-4E05-B6BA-FF7115FD0B7B}\Plain Text Background

If the user has not modified the color, you could key off of the theme they are using based on this registry value:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\General\CurrentTheme

Upvotes: 1

Related Questions