Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change background color of Solution Explorer in Visual Studio

Is there any way to change the background color of the Solution Explorer in Visual Studio using a Theme? - or any other way for that matter?

I can change it by changing windows-wide color settings, but obviously that affects too much.

like image 414
zadam Avatar asked Oct 09 '08 20:10

zadam


People also ask

How do I change the background color in Visual Studio?

Here's how to change it to a different color theme. On the menu bar, select Tools > Options. In the options list, select Environment > General. In the Color theme list, choose between the default Dark theme, the Blue theme, the Blue (Extra Contrast) theme, and the Light theme.


4 Answers

Just created VS extension for that in under an hour, search extension manager for "SExColor". Enjoy ;)

like image 131
Ivan G. Avatar answered Sep 23 '22 05:09

Ivan G.


@aloneguid ...should have seen this long time ago.. thank you sir !

@ver (regarding vs 2008 solution for solution;) - a B52 type of approach, carpet bombing on anything that is SysTreeView32 inside a devenv.exe. Possible extra param for desired color, otherwise RGB(220,220,220) - works best for me

#include <windows.h> #include "psapi.h" #include "shlwapi.h" #include "commctrl.h"   COLORREF clr = RGB(220,220,220);  BOOL CALLBACK wenum( HWND hwnd, LPARAM lParam) {    const UINT cb = 261;    static wchar_t    name[] = L"SysTreeView32",                      tmp[cb] = {0};    if( ::GetClassNameW( hwnd, tmp, 260 ) && 0 == _wcsicmp( name, tmp ) )    {       ::SendMessageW( hwnd, TVM_SETBKCOLOR, 0, (LPARAM)clr );    }     return TRUE; }  BOOL CALLBACK EnumTops(HWND hwnd, LPARAM lParam)  {     DWORD             dwThreadId  = 0,                       dwProcessId = 0;     HINSTANCE         hInstance;    static wchar_t derVS[]     = L"devenv.exe";    wchar_t  name[_MAX_PATH]   = {0},             *exe              = 0;      HANDLE hProcess;    if (!hwnd)  return TRUE;     // Not a window    if (!::IsWindowVisible(hwnd)) return TRUE;       // Not visible     if (!SendMessage(hwnd, WM_GETTEXT, sizeof(name), (LPARAM)name))       return TRUE;      // No window title    dwThreadId = GetWindowThreadProcessId(hwnd, &dwProcessId);    hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessId);    if( !GetModuleFileNameEx(hProcess, 0, name, sizeof(name))) goto exit;     exe = ::PathFindFileNameW( name );    if( (void*)exe == (void*)name ) goto exit; // mhm? maybe not exit?     if( _wcsicmp( derVS, exe ) ) goto exit;     EnumChildWindows( hwnd, wenum, (LPARAM)hProcess );  exit:    CloseHandle(hProcess);    int res = GetLastError();    return res; }  int wmain(int argc, wchar_t * argv[])  {    if( argc >= 2 )    {       wchar_t *end = 0;       long l = wcstol( argv[1], &end, 16 );       clr = (DWORD)l;    }    ::EnumWindows(EnumTops, NULL);    return 0; } 
like image 28
user1195662 Avatar answered Sep 22 '22 05:09

user1195662


Even changing the standard Windows background color does not work for the Solution Explorer. This Visual Studio bug report mentions the issue. Microsoft has marked this as "Closed -- Won't Fix."

Which is very irritating! Using a dark theme and having a bright white Solution Explorer hanging on the side of the screen is extremely annoying.

One possible solution is to not use the Solution Explorer at all. The Productivity Power Tools provides a Solution Explorer replacement called the "Solution Navigator." It currently is also hard-coded to white. But I think there is probably a better chance of getting the developers of that tool to add support for modifying colors than of getting Microsoft to do it in Visual Studio. (even though Microsoft created the PPTs.)

like image 20
CleverPatrick Avatar answered Sep 23 '22 05:09

CleverPatrick


Not by any means of configuration from Visual Studio itself.

You can however probably "hack" the window object from the Win32 API (look up "window enumeration"). Once you have the window handle, you can set all characterstics you want.

Regards

/Robert

like image 39
sharkin Avatar answered Sep 22 '22 05:09

sharkin