SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit ee3f37b39cdbbda4ca9f94a4d60104975b9e726d parent ebfc877c1cc4933cc40b035bc9febef4b53378fa Author: Lior Halphon <LIJI32@gmail.com> Date: Thu, 21 Nov 2024 19:54:45 +0200 Fix button colors in some themes Diffstat:
| M | iOS/GBBackgroundView.m | 2 | +- |
| M | iOS/GBTheme.h | 1 | + |
| M | iOS/GBTheme.m | 10 | ++++++++++ |
| M | iOS/GBViewController.m | 4 | ++-- |
4 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/iOS/GBBackgroundView.m b/iOS/GBBackgroundView.m @@ -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; diff --git a/iOS/GBTheme.h b/iOS/GBTheme.h @@ -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; diff --git a/iOS/GBTheme.m b/iOS/GBTheme.m @@ -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; diff --git a/iOS/GBViewController.m b/iOS/GBViewController.m @@ -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, *)) {
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.