Skip to content

Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.

C

feat: Accent color offers Apple Music red under either look

My-Name-Is-Jeffab7796c7756f
diff --git a/tweak/Sources/Core/SGPrefs.h b/tweak/Sources/Core/SGPrefs.h
index d5b724cc..4ec218e8 100644
--- a/tweak/Sources/Core/SGPrefs.h
+++ b/tweak/Sources/Core/SGPrefs.h
@@ -31,3 +31,6 @@ void SGMigrateKey(NSString *from, NSString *to);
// Quits Spotify so the hooks read the switches afresh on the next launch; the writes reach cfprefsd first.
void SGRestartSpotify(void);
+
+// Apple Music's red, 0xRRGGBB, offered under either look's accent colour.
+#define SGAppleMusicRed 0xFA2D48
diff --git a/tweak/Sources/Native/Appearance/Accent.x b/tweak/Sources/Native/Appearance/Accent.x
index 335714f7..93a29236 100644
--- a/tweak/Sources/Native/Appearance/Accent.x
+++ b/tweak/Sources/Native/Appearance/Accent.x
@@ -35,6 +35,7 @@ UIColor *SGAccentColor(void) {
NSString *SGAccentLabel(void) {
NSInteger rgb = chosen();
+ if (rgb == SGAppleMusicRed) return @"Apple Music red";
return rgb < 0 ? @"Spotify green" : [NSString stringWithFormat:@"#%06lX", (long)rgb];
}
diff --git a/tweak/Sources/Native/Appearance/AppearanceSettings.m b/tweak/Sources/Native/Appearance/AppearanceSettings.m
index 2df5344c..6d1c2aa0 100644
--- a/tweak/Sources/Native/Appearance/AppearanceSettings.m
+++ b/tweak/Sources/Native/Appearance/AppearanceSettings.m
@@ -3,17 +3,15 @@
#import "Settings/SGPageStyle.h"
#import "Appearance.h"
-// Going back to Spotify's green is offered only once a colour of the mod's is set, so a stray tap
-// cannot wipe it.
+// Apple Music's red is one tap away, unless it is the colour already. Going back to Spotify's green is
+// offered only once a colour of the mod's is set, so a stray tap cannot wipe it.
static void chooseAccent(void) {
- if (!SGAccentColor()) {
- SGPickAccent();
- return;
- }
UIViewController *top = SGTopController();
UIAlertController *sheet = [UIAlertController alertControllerWithTitle:@"Accent colour" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
+ if (SGInt(SGKeyAccent, -1) != SGAppleMusicRed)
+ [sheet addAction:[UIAlertAction actionWithTitle:@"Apple Music red" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { SGSetInt(SGKeyAccent, SGAppleMusicRed); }]];
[sheet addAction:[UIAlertAction actionWithTitle:@"Pick a colour" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { SGPickAccent(); }]];
- [sheet addAction:[UIAlertAction actionWithTitle:@"Spotify's green" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) { SGSetInt(SGKeyAccent, -1); }]];
+ if (SGAccentColor()) [sheet addAction:[UIAlertAction actionWithTitle:@"Spotify green" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { SGSetInt(SGKeyAccent, -1); }]];
[sheet addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];
sheet.popoverPresentationController.sourceView = top.view;
sheet.popoverPresentationController.sourceRect = CGRectMake(CGRectGetMidX(top.view.bounds), CGRectGetMidY(top.view.bounds), 0, 0);
diff --git a/tweak/Sources/Redesigned/Kit/SGRAccent.x b/tweak/Sources/Redesigned/Kit/SGRAccent.x
index 26e5b8e3..54cbbece 100644
--- a/tweak/Sources/Redesigned/Kit/SGRAccent.x
+++ b/tweak/Sources/Redesigned/Kit/SGRAccent.x
@@ -39,6 +39,7 @@ UIColor *SGRAccentColor(void) {
NSString *SGRAccentLabel(void) {
NSInteger rgb = chosen();
+ if (rgb == SGAppleMusicRed) return @"Apple Music red";
return rgb < 0 ? @"Spotify green" : [NSString stringWithFormat:@"#%06lX", (long)rgb];
}
diff --git a/tweak/Sources/Redesigned/Kit/SGRAppearanceSettings.m b/tweak/Sources/Redesigned/Kit/SGRAppearanceSettings.m
index c7614d28..24ddf43f 100644
--- a/tweak/Sources/Redesigned/Kit/SGRAppearanceSettings.m
+++ b/tweak/Sources/Redesigned/Kit/SGRAppearanceSettings.m
@@ -3,17 +3,15 @@
#import "Settings/SGPageStyle.h"
#import "SGRAccent.h"
-// Going back to Spotify's green is offered only once a colour of the mod's is set, so a stray tap
-// cannot wipe it.
+// Apple Music's red is one tap away, unless it is the colour already. Going back to Spotify's green is
+// offered only once a colour of the mod's is set, so a stray tap cannot wipe it.
static void chooseAccent(void) {
- if (!SGRAccentColor()) {
- SGRPickAccent();
- return;
- }
UIViewController *top = SGTopController();
UIAlertController *sheet = [UIAlertController alertControllerWithTitle:@"Accent colour" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
+ if (SGInt(SGRKeyAccent, -1) != SGAppleMusicRed)
+ [sheet addAction:[UIAlertAction actionWithTitle:@"Apple Music red" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { SGSetInt(SGRKeyAccent, SGAppleMusicRed); }]];
[sheet addAction:[UIAlertAction actionWithTitle:@"Pick a colour" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { SGRPickAccent(); }]];
- [sheet addAction:[UIAlertAction actionWithTitle:@"Spotify's green" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) { SGSetInt(SGRKeyAccent, -1); }]];
+ if (SGRAccentColor()) [sheet addAction:[UIAlertAction actionWithTitle:@"Spotify green" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { SGSetInt(SGRKeyAccent, -1); }]];
[sheet addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];
sheet.popoverPresentationController.sourceView = top.view;
sheet.popoverPresentationController.sourceRect = CGRectMake(CGRectGetMidX(top.view.bounds), CGRectGetMidY(top.view.bounds), 0, 0);