Skip to content

Commit

Permalink
Further improvements in dark mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
wp-xyz committed Nov 10, 2024
1 parent 4822275 commit 1c8db27
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 19 deletions.
2 changes: 1 addition & 1 deletion source/forms/hxabout.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ object AboutForm: TAboutForm
ClientWidth = 381
Position = poMainFormCenter
ShowHint = True
LCLVersion = '3.99.0.0'
LCLVersion = '4.99.0.0'
OnCreate = FormCreate
object Image1: TImage
AnchorSideLeft.Control = Owner
Expand Down
10 changes: 9 additions & 1 deletion source/forms/hxabout.pas
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, Buttons,
hxGlobal, hxUtils_NonGUI;
hxGlobal, hxUtils_NonGUI, hxUtils;

type

Expand Down Expand Up @@ -56,13 +56,21 @@ implementation
{ TAboutForm }

procedure TAboutForm.FormCreate(Sender: TObject);
var
mode: TScreenMode;
begin
with Image1 do
begin
Picture.Assign(Application.Icon);
Picture.Icon.Current := Picture.Icon.GetBestIndexForSize(Size(Width, Height));
end;
lblVersion.Caption := 'Version: ' + GetVersionStr();
mode := GetScreenMode;
lblFPC.Font.Color := LINK_COLOR[mode];
lblLazarus.Font.Color := LINK_COLOR[mode];
lblMichal.Font.Color := LINK_COLOR[mode];
lblOndrej.Font.Color := LINK_COLOR[mode];
lblIcons8.Font.Color := LINK_COLOR[mode];
end;

procedure TAboutForm.lblURLClick(Sender: TObject);
Expand Down
2 changes: 1 addition & 1 deletion source/forms/hxdatamodule.lfm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
object CommonData: TCommonData
OldCreateOrder = False
Height = 448
Height = 180
HorizontalOffset = 340
VerticalOffset = 128
Width = 300
Expand Down
26 changes: 25 additions & 1 deletion source/forms/hxdatamodule.pas
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ TCommonData = class(TDataModule)
Images_SimpleSmall: TImageList;
private
FImages_SimpleSmall_DarkMode: TImageList;
FDisabledImages_SimpleSmall_DarkMode: TImageList;
function GetDisabledImages: TImageList;
function GetDisabledImages_SimpleSmall_DarkMode: TImageList;
function GetImages: TImageList;
function GetImages_SimpleSmall_DarkMode: TImageList;

public
property Images: TImageList read GetImages;
property Images_SimpleSmall_DarkMode: TImageList read GetImages_SimpleSmall_DarkMode;
property DisabledImages: TImageList read GetDisabledImages;

end;

Expand All @@ -34,6 +38,26 @@ implementation

{$R *.lfm}

function TCommonData.GetDisabledImages: TImageList;
begin
case GuiParams.IconSet of
isOffice:
Result := nil;
isSimpleSmall:
if IsDarkMode then
Result := GetDisabledImages_SimpleSmall_DarkMode
else
Result := nil;
end;
end;

function TCommonData.GetDisabledImages_SimpleSmall_DarkMode: TImageList;
begin
if FDisabledImages_SimpleSmall_DarkMode = nil then
FDisabledImages_SimpleSmall_DarkMode := CreateRecoloredImageList(Images_SimpleSmall, $606060, [$FFFFFF], [14], self);
Result := FDisabledImages_SimpleSmall_DarkMode;
end;

function TCommonData.GetImages: TImageList;
begin
case GuiParams.IconSet of
Expand All @@ -50,7 +74,7 @@ function TCommonData.GetImages: TImageList;
function TCommonData.GetImages_SimpleSmall_DarkMode: TImageList;
begin
if FImages_SimpleSmall_DarkMode = nil then
FImages_SimpleSmall_DarkMode := CreateRecoloredImageList(Images_SimpleSmall, $FFFFFF, [$FFFFFF], [14], self);
FImages_SimpleSmall_DarkMode := CreateRecoloredImageList(Images_SimpleSmall, $CFCFCF, [$FFFFFF], [14], self);
Result := FImages_SimpleSmall_DarkMode;
end;

Expand Down
22 changes: 11 additions & 11 deletions source/forms/hxmain.lfm
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
object MainForm: TMainForm
Left = 372
Height = 437
Height = 450
Top = 236
Width = 914
Width = 851
AllowDropFiles = True
Caption = 'Hex'
ClientHeight = 437
ClientWidth = 914
ClientHeight = 450
ClientWidth = 851
Menu = MainMenu
ShowHint = True
LCLVersion = '3.99.0.0'
LCLVersion = '4.99.0.0'
OnActivate = FormActivate
OnCloseQuery = FormCloseQuery
OnCreate = FormCreate
OnDropFiles = FormDropFiles
OnShow = FormShow
object PageControl: TPageControl
Left = 0
Height = 389
Height = 397
Top = 30
Width = 914
Width = 851
Align = alClient
TabOrder = 0
OnChange = PageControlChange
Expand All @@ -28,7 +28,7 @@ object MainForm: TMainForm
Left = 0
Height = 30
Top = 0
Width = 914
Width = 851
AutoSize = True
Bands = <
item
Expand Down Expand Up @@ -157,9 +157,9 @@ object MainForm: TMainForm
end
object StatusBar: TStatusBar
Left = 0
Height = 18
Top = 419
Width = 914
Height = 23
Top = 427
Width = 851
AutoHint = True
Panels = <
item
Expand Down
1 change: 1 addition & 0 deletions source/forms/hxmain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,7 @@ procedure TMainForm.UpdateIconSet;
ActionList.Images := CommonData.Images;
MainMenu.Images := CommonData.Images;
Toolbar.Images := CommonData.Images;
Toolbar.DisabledImages := CommonData.DisabledImages;

for i := 0 to PageControl.PageCount-1 do begin
F := GetHexEditorFrame(i);
Expand Down
9 changes: 5 additions & 4 deletions source/units/hxglobal.pas
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,9 @@ TColorParams = record
clMaroon = TGraphicsColor($00000080);
clYellow = TGraphicsColor($0000FFFF);
clOlive = TGraphicsColor($00008080);
clBlack = TGraphicsColor($00000000);
clSilver = TGraphicsColor($00C0C0C0);
clSkyBlue = TGraphicsColor($00F0CAA6);

LINK_COLOR: array[TScreenMode] of TGraphicsColor = (clBlue, clSkyBlue);

var
HexParams: THexParams = (
Expand Down Expand Up @@ -281,8 +282,8 @@ TColorParams = record
ActiveFieldBackgroundColor: clWindow;
OffsetBackgroundColor: clBtnFace;
OffsetForegroundColor: clWindowText;
CurrentOffsetBackgroundColor: clSilver;
CurrentOffsetForegroundColor: clBlack;
CurrentOffsetBackgroundColor: clBtnShadow;
CurrentOffsetForegroundColor: clBtnHighlight;
EvenColumnForegroundColor: clOlive;
OddColumnForegroundColor: clYellow;
ChangedBackgroundColor: $00A8FFFF;
Expand Down

0 comments on commit 1c8db27

Please sign in to comment.