mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-16 06:09:29 +02:00
Merge branch 'opm-fix-colors' into 'main'
opm: fix readability of hint window on dark themes, remove hardcoded colors... See merge request freepascal.org/lazarus/lazarus!13
This commit is contained in:
commit
256ef8de78
@ -57,10 +57,15 @@ begin
|
||||
end;
|
||||
|
||||
procedure TColorsFrm.HelpButtonClick(Sender: TObject);
|
||||
var
|
||||
CL: TStringList;
|
||||
begin
|
||||
shName.Brush.Color := $00D9FFFF;
|
||||
shDescription.Brush.Color := $00E6FFE6;
|
||||
shLicense.Brush.Color := $00FEEBD3;
|
||||
CL := TStringList.Create;
|
||||
Options.GetDefaultColors(CL);
|
||||
shName.Brush.Color := StringToColor(CL.Strings[0]);
|
||||
shDescription.Brush.Color := StringToColor(CL.Strings[1]);
|
||||
shLicense.Brush.Color := StringToColor(CL.Strings[2]);
|
||||
CL.Free;
|
||||
end;
|
||||
|
||||
procedure TColorsFrm.shNameMouseUp(Sender: TObject; Button: TMouseButton;
|
||||
@ -72,18 +77,11 @@ end;
|
||||
|
||||
procedure TColorsFrm.LoadColors(AColList: TStringList);
|
||||
begin
|
||||
if AColList.Count = HintColCnt then
|
||||
begin
|
||||
shName.Brush.Color := StringToColor(AColList.Strings[0]);
|
||||
shDescription.Brush.Color := StringToColor(AColList.Strings[1]);
|
||||
shLicense.Brush.Color := StringToColor(AColList.Strings[2]);
|
||||
end
|
||||
else
|
||||
begin
|
||||
shName.Brush.Color := clDefault;
|
||||
shDescription.Brush.Color := clDefault;
|
||||
shLicense.Brush.Color := clDefault;
|
||||
end;
|
||||
if AColList.Count <> HintColCnt then
|
||||
Options.GetDefaultColors(AColList);
|
||||
shName.Brush.Color := StringToColor(AColList.Strings[0]);
|
||||
shDescription.Brush.Color := StringToColor(AColList.Strings[1]);
|
||||
shLicense.Brush.Color := StringToColor(AColList.Strings[2]);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -27,7 +27,7 @@ unit opkman_options;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Graphics,
|
||||
Classes, SysUtils, Graphics, GraphUtil,
|
||||
// LazUtils
|
||||
Laz2_XMLCfg, LazFileUtils,
|
||||
// IdeIntf
|
||||
@ -89,6 +89,7 @@ type
|
||||
FExcludedFolders: String;
|
||||
FOpenSSLDownloadType: Integer;
|
||||
procedure CheckColors;
|
||||
function IsDarkTheme: Boolean;
|
||||
function GetLocalRepositoryArchiveExpanded:string;
|
||||
function GetLocalRepositoryPackagesExpanded:string;
|
||||
function GetLocalRepositoryUpdateExpanded:string;
|
||||
@ -99,6 +100,7 @@ type
|
||||
procedure Save;
|
||||
procedure LoadDefault;
|
||||
procedure CreateMissingPaths;
|
||||
procedure GetDefaultColors(AColorList: TStringList);
|
||||
property LocalRepositoryPackagesExpanded:string read GetLocalRepositoryPackagesExpanded;
|
||||
property LocalRepositoryArchiveExpanded:string read GetLocalRepositoryArchiveExpanded;
|
||||
property LocalRepositoryUpdateExpanded:string read GetLocalRepositoryUpdateExpanded;
|
||||
@ -331,15 +333,24 @@ begin
|
||||
CreateDir(LocalRepositoryUpdateExpanded);
|
||||
end;
|
||||
|
||||
procedure TOptions.GetDefaultColors(AColorList: TStringList);
|
||||
begin
|
||||
AColorList.Clear;
|
||||
if IsDarkTheme then
|
||||
AColorList.AddStrings(['$00004646', '$002e4c35', '$00584327'])
|
||||
else
|
||||
AColorList.AddStrings(['$00D9FFFF', '$00E6FFE6', '$00FEEBD3']);
|
||||
end;
|
||||
|
||||
procedure TOptions.CheckColors;
|
||||
begin
|
||||
if FHintFormOptionColors.Count <> HintColCnt then
|
||||
begin
|
||||
FHintFormOptionColors.Clear;
|
||||
FHintFormOptionColors.Add(ColorToString($00D9FFFF));
|
||||
FHintFormOptionColors.Add(ColorToString($00E6FFE6));
|
||||
FHintFormOptionColors.Add(ColorToString($00FEEBD3));
|
||||
end
|
||||
GetDefaultColors(FHintFormOptionColors);
|
||||
end;
|
||||
|
||||
function TOptions.IsDarkTheme: Boolean;
|
||||
begin
|
||||
Result := ColorToGray(clWindowText) > ColorToGray(clWindow);
|
||||
end;
|
||||
|
||||
function TOptions.GetLocalRepositoryArchiveExpanded:string;
|
||||
|
@ -22,20 +22,15 @@ object ShowHintFrm: TShowHintFrm
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = Owner
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 10
|
||||
Height = 305
|
||||
Top = 10
|
||||
Width = 543
|
||||
Left = 0
|
||||
Height = 325
|
||||
Top = 0
|
||||
Width = 563
|
||||
Align = alClient
|
||||
Anchors = [akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 10
|
||||
BorderSpacing.Top = 10
|
||||
BorderSpacing.Right = 10
|
||||
BorderSpacing.Bottom = 10
|
||||
BevelInner = bvLowered
|
||||
ClientHeight = 305
|
||||
ClientWidth = 543
|
||||
Color = 15460842
|
||||
ClientHeight = 325
|
||||
ClientWidth = 563
|
||||
ParentColor = False
|
||||
TabOrder = 0
|
||||
object pnPackageName: TPanel
|
||||
@ -45,25 +40,23 @@ object ShowHintFrm: TShowHintFrm
|
||||
Left = 12
|
||||
Height = 22
|
||||
Top = 2
|
||||
Width = 519
|
||||
Width = 539
|
||||
Align = alTop
|
||||
BorderSpacing.Left = 10
|
||||
BorderSpacing.Right = 10
|
||||
BevelOuter = bvNone
|
||||
Caption = 'Package Name'
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
end
|
||||
object pnDescription: TPanel
|
||||
Left = 2
|
||||
Height = 57
|
||||
Top = 24
|
||||
Width = 539
|
||||
Width = 559
|
||||
Align = alTop
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 57
|
||||
ClientWidth = 539
|
||||
ClientWidth = 559
|
||||
ParentFont = False
|
||||
TabOrder = 1
|
||||
object mDescription: TMemo
|
||||
@ -76,25 +69,17 @@ object ShowHintFrm: TShowHintFrm
|
||||
Left = 10
|
||||
Height = 53
|
||||
Top = 2
|
||||
Width = 519
|
||||
Width = 539
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 10
|
||||
BorderSpacing.Top = 2
|
||||
BorderSpacing.Right = 10
|
||||
BorderSpacing.Bottom = 2
|
||||
BorderStyle = bsNone
|
||||
Color = 15460842
|
||||
Font.CharSet = ANSI_CHARSET
|
||||
Font.Color = clBlack
|
||||
Font.Height = -12
|
||||
Font.Name = 'Segoe UI'
|
||||
Font.Pitch = fpVariable
|
||||
Font.Quality = fqDraft
|
||||
Lines.Strings = (
|
||||
'aaaaaaaaaa'
|
||||
'bbbbbbbb'
|
||||
)
|
||||
ParentFont = False
|
||||
ReadOnly = True
|
||||
TabOrder = 0
|
||||
end
|
||||
@ -108,9 +93,9 @@ object ShowHintFrm: TShowHintFrm
|
||||
AnchorSideBottom.Control = pnMain
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 12
|
||||
Height = 218
|
||||
Height = 238
|
||||
Top = 83
|
||||
Width = 519
|
||||
Width = 539
|
||||
HorzScrollBar.Page = 1
|
||||
VertScrollBar.Page = 1
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
@ -126,7 +111,7 @@ object ShowHintFrm: TShowHintFrm
|
||||
object tmWait: TTimer
|
||||
Enabled = False
|
||||
OnTimer = tmWaitTimer
|
||||
left = 40
|
||||
top = 160
|
||||
Left = 40
|
||||
Top = 160
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user