Skip to content

Commit

Permalink
Fix button colors in some themes
Browse files Browse the repository at this point in the history
  • Loading branch information
LIJI32 committed Nov 21, 2024
1 parent ebfc877 commit ee3f37b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion iOS/GBBackgroundView.m
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ - (void)setLayout:(GBLayout *)layout

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;
Expand Down
1 change: 1 addition & 0 deletions iOS/GBTheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions iOS/GBTheme.m
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,16 @@ - (instancetype)initDarkTheme
}


- (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;
Expand Down
4 changes: 2 additions & 2 deletions iOS/GBViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
[[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];
Expand Down Expand Up @@ -376,7 +376,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
_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, *)) {
Expand Down

0 comments on commit ee3f37b

Please sign in to comment.