Browse Source

Give wizard form proper dark color which is tcToolBack and not tcBack.

Martijn Laan 2 months ago
parent
commit
accaba71e7

+ 3 - 0
Components/ModernColors.pas

@@ -43,6 +43,9 @@ const
 
   DFore = $D6D6D6;           { VSCode Modern Dark, 2 tints lightened using color-hex.com }
   DBack = $1F1F1F;           { VSCode Modern Dark }
+  { If you combine this unit with a dark VCL Style then the following color should match the style's
+    window background color. Value can be found using BitmapStyleDesigner.exe from BDS\Bin. Open the
+    style .vsf file, go to the Colors section and then to the Window color. }
   DToolBack = $2B2B2B;       { VCL Style 'Windows11 Dark 1.0' }
   DSelBack = $764F1D;        { VSCode Modern Dark }
   //DSelInactiveBack = $51504F;{ VSCode Modern Dark }

+ 7 - 4
Projects/Src/IDE.HelperFunc.pas

@@ -28,7 +28,7 @@ procedure InitFormFont(Form: TForm);
 procedure SetControlWindowTheme(const WinControl: TWinControl; const Dark: Boolean);
 procedure InitFormThemeInit(const Theme: TTheme);
 function InitFormTheme(const Form: TForm): Boolean;
-function InitFormThemeGetBkColor: TColor;
+function InitFormThemeGetBkColor(const Form: TForm): TColor;
 function GetDisplayFilename(const Filename: String): String;
 function GetFileTitle(const Filename: String): String;
 function GetCleanFileNameOfFile(const Filename: String): String;
@@ -149,7 +149,7 @@ function InitFormTheme(const Form: TForm): Boolean;
 begin
   Result := (Form = MainForm) or FormTheme.Dark;
   if Result then begin
-    Form.Color := InitFormThemeGetBkColor;
+    Form.Color := InitFormThemeGetBkColor(Form);
 
     { Based on https://learn.microsoft.com/en-us/windows/apps/desktop/modernize/apply-windows-themes
       Unlike this article we check for Windows 10 Version 2004 because that's the first version
@@ -165,9 +165,12 @@ begin
   end;
 end;
 
-function InitFormThemeGetBkColor: TColor;
+function InitFormThemeGetBkColor(const Form: TForm): TColor;
 begin
-  Result := FormTheme.Colors[tcBack];
+  if Form = MainForm then
+    Result := FormTheme.Colors[tcBack]
+  else
+    Result := FormTheme.Colors[tcToolBack];
 end;
 
 function GetDisplayFilename(const Filename: String): String;

+ 1 - 1
Projects/Src/IDE.Wizard.WizardForm.pas

@@ -299,7 +299,7 @@ begin
 
   InitFormFont(Self);
   if not InitFormTheme(Self) then
-    OuterNotebook.Color := InitFormThemeGetBkColor;
+    OuterNotebook.Color := InitFormThemeGetBkColor(Self);
 
   if Font.Name = 'Segoe UI' then begin
     { See Setup.WizardForm.pas }