Issue700-Fix.md
In Windows 11 Canary builds, the color auto setting for Nilesoft Shell was broken. This resulted in incorrect theme colors being applied to context menus, particularly affecting users on the Windows Insider program using Canary channel builds.
The issue was caused by changes in how Windows 11 Canary builds handle theme data. Specifically:
GetThemeColor and DrawThemeBackground) behave differently in Canary builds.Updated the Windows.h file to detect Windows 11 Insider builds:
bool IsCanaryBuild = false;
bool IsDevBuild = false;
bool IsBetaBuild = false;
bool IsPreviewBuild = false;
Added code to detect the Insider channel by reading the FlightRing registry value:
string flightRing = key.GetString(L"FlightRing").move();
if(!flightRing.empty())
{
if(flightRing.iequals(L"Canary"))
IsCanaryBuild = true;
else if(flightRing.iequals(L"Dev"))
IsDevBuild = true;
else if(flightRing.iequals(L"Beta"))
IsBetaBuild = true;
else if(flightRing.iequals(L"ReleasePreview"))
IsPreviewBuild = true;
}
Added a new helper function to identify Canary/Dev builds:
bool IsWindows11CanaryOrDev() const
{
return IsWindows11OrGreater() && (IsCanaryBuild || IsDevBuild);
}
Updated the ContextMenu.cpp file to handle Canary builds differently:
Key changes include:
// Special handling for Windows 11 Canary and Dev builds
bool isCanaryOrDev = ver->IsWindows11CanaryOrDev();
// Use more reliable theme color detection for Canary builds
if (isCanaryOrDev)
{
// Get text colors with fallbacks to system colors
if (!get_clr(nor, MENU_POPUPITEM, MPI_NORMAL, TMT_TEXTCOLOR))
{
nor.from(::GetSysColor(COLOR_MENUTEXT), 100);
}
// ... similar fallbacks for other colors
}
The fix has been tested on:
All builds now correctly detect and apply theme colors in both light and dark modes.