Here is a good way to do it. Select "Macro IDE ...", then open "EnvironmentEvents" and add the following after the "Automatically Generated Code" area:
Sub handleColorSettings () Handles SolutionEvents.opened, DocumentEvents.documentopening
Dim myColor As UInt32
myColor = & HC0FFFF
Try
myColor = UInt32.Parse (IO.File.ReadAllText (DTE.Solution.FullName & ".bgcolor.txt"), Globalization.NumberStyles.AllowHexSpecifier)
Catch ex as exception
End try
CType (DTE.Properties ("FontsAndColors", "TextEditor"). Item ("FontsAndColorsItems"). Object, EnvDTE.FontsAndColorsItems) .Item ("Plain Text"). Background = myColor
End sub
At any time, when a project is opened or a file is opened within the project, the system will search for a file with the name "(fullSolutionName) .bgcolor.txt". If, for example, the solution is "myThing.sln", the file used will be "myThing.sln.bgcolor.txt". If such a file is found and it contains a valid hexadecimal number, which will be used as the background color. Otherwise, the default color will be used (& hC0FFFF higher, but easily replaceable).
source share