Changeset 113
- Timestamp:
- Dec 10, 2024, 4:51:28 PM (11 days ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Game.pas
r112 r113 151 151 152 152 uses 153 Core, MetaCanvas, PixelPointer ;153 Core, MetaCanvas, PixelPointer, Theme; 154 154 155 155 procedure Translate; … … 1146 1146 Color: TPixel32; 1147 1147 begin 1148 if Core.Core.ThemeManager1.Theme.Name = 'Dark' then begin 1148 if (Core.Core.ThemeManager1.Theme.Name = ThemeNameDark) or 1149 ((Core.Core.ThemeManager1.Theme.Name = ThemeNameSystem) and 1150 Core.Core.ThemeManager1.IsDarkTheme) 1151 then begin 1149 1152 case Value of 1150 1153 0: Result := $222629; -
trunk/Packages/Common/Theme.pas
r85 r113 30 30 private 31 31 FTheme: TTheme; 32 function Gray(C: TColor): Byte; 32 33 procedure SetTheme(AValue: TTheme); 33 34 procedure SetThemeName(AValue: TTheme); … … 35 36 Used: Boolean; 36 37 Themes: TThemes; 38 function IsDarkTheme: Boolean; 37 39 procedure ApplyTheme(Component: TComponent); 38 40 constructor Create(AOwner: TComponent); override; … … 93 95 Strings.EndUpdate; 94 96 end; 97 end; 98 99 { TThemeManager } 100 101 function TThemeManager.Gray(C: TColor): Byte; 102 begin 103 Result := Trunc(Red(C) * 0.3 + Green(C) * 0.59 + Blue(C) * 0.11); 104 end; 105 106 function TThemeManager.IsDarkTheme: Boolean; 107 begin 108 Result := Gray(ColorToRGB(clWindow)) < Gray(ColorToRGB(clWindowText)); 95 109 end; 96 110
Note:
See TracChangeset
for help on using the changeset viewer.