Fix button colors in some themes

This commit is contained in:
Lior Halphon 2024-11-21 19:54:45 +02:00
parent ebfc877c1c
commit ee3f37b39c
4 changed files with 14 additions and 3 deletions

View File

@ -497,7 +497,7 @@ static GB_key_mask_t angleToKeyMask(double angle)
if (@available(iOS 13.0, *)) {
self.overrideUserInterfaceStyle = layout.theme.isDark? UIUserInterfaceStyleDark : UIUserInterfaceStyleLight;
self.tintColor = layout.theme.brandColor;
self.tintColor = layout.theme.buttonColor;
}
_screenLabel.frame = screenFrame;

View File

@ -2,6 +2,7 @@
@interface GBTheme : NSObject
@property (readonly, direct) UIColor *brandColor;
@property (readonly, direct) UIColor *buttonColor;
@property (readonly, direct) UIColor *backgroundGradientTop;
@property (readonly, direct) UIColor *backgroundGradientBottom;
@property (readonly, direct) UIColor *bezelsGradientTop;

View File

@ -155,6 +155,16 @@ __attribute__((objc_direct_members))
}
- (UIColor *)buttonColor
{
double r, g, b;
[_brandColor getRed:&r green:&g blue:&b alpha:NULL];
if (r == 1.0 && g == 1.0 && b == 1.0) {
return _backgroundGradientTop;
}
return [UIColor colorWithRed:r green:g blue:b alpha:1.0];
}
- (bool)isDark
{
double r, g, b;

View File

@ -229,7 +229,7 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp)
[[GBHorizontalLayout alloc] initWithTheme:theme cutoutOnRight:true] :
_horizontalLayoutLeft;
_verticalLayout = [[GBVerticalLayout alloc] initWithTheme:theme];
_printerSpinner.color = theme.brandColor;
_printerSpinner.color = theme.buttonColor;
[self willRotateToInterfaceOrientation:[UIApplication sharedApplication].statusBarOrientation
duration:0];
@ -376,7 +376,7 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp)
_printerButton = [[UIButton alloc] init];
_printerSpinner = [[UIActivityIndicatorView alloc] init];
_printerSpinner.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
_printerSpinner.color = _verticalLayout.theme.brandColor;
_printerSpinner.color = _verticalLayout.theme.buttonColor;
[self didRotateFromInterfaceOrientation:[UIApplication sharedApplication].statusBarOrientation];
if (@available(iOS 13.0, *)) {