0

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.

Csharp
  • 2,916
  • 16
  • 50
  • 77
Levi H
  • 3,426
  • 7
  • 30
  • 43

2 Answers2

1

This is probably what you are after: IVsFontAndColorStorage interface

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

ptutt
  • 1,338
  • 3
  • 18
  • 35
  • Except that will only work for a specific theme, VS2012 comes with 3 default themes. – Levi H Jul 04 '13 at 01:22
  • Jesus, I frickin found how to read the ColorableItemInfo, how do I bloody get the final color out of the uint stored there??? – cubrman Aug 30 '16 at 09:33
1

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
John Koerner
  • 37,428
  • 8
  • 84
  • 134