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: the redesign always black with an accent colour of its own, and a restart offered when Redesigned UI flips

Vojtěch Škopek8b43d264023c
diff --git a/docs/tweaks.md b/docs/tweaks.md
index e07e10a0..105cd9e1 100644
--- a/docs/tweaks.md
+++ b/docs/tweaks.md
@@ -100,7 +100,8 @@ Native:
Redesigned:
Kit/ what the redesign builds on (SGRKit.h lists it), the flags it forces (SGRedesign.h, SGRGlassDesign.x for
- Spotify's own glass design), its repaint hook (SGRRepaint.x) and soft top edge
+ Spotify's own glass design), its repaint hook (SGRRepaint.x), soft top edge, AMOLED black (always on,
+ SGRAmoled.x) and its own accent colour (SGRAccent.x, stored apart from the native look's)
Navbar/ the glass tab bar (TabBar.x) over its own composition (Navbar.x, NavbarLayout.m) and editor, the glass search field
NowPlayingBar/ the glass now playing bar
Player/ the redesigned full screen player (Player.h lists its files)
@@ -139,9 +140,10 @@ Mod Settings, opened by holding Home on the tab bar or from the first row of the
last row of Spotify's Settings, sorts every
setting by the part of Spotify it changes, so a part's glass, its hide switches and its flags sit on
one page, the mod's own rows first and Spotify's flags below them or on a sub page named after what
-they change. It opens on the Appearance card: Redesigned UI, and in the native look AMOLED and the accent colour
-(Spotify's green is offered from the colour row once a colour is set). Redesigned UI is the one switch
-between the two looks (see Layers): it glows (Settings/SGGlowSwitch) and its ⓘ says what it changes.
+they change. It opens on the Appearance card: Redesigned UI, then the stored look's accent colour, and in the native
+look AMOLED (the redesign is always black); Spotify's green is offered from the colour row once a colour
+is set. Redesigned UI is the one switch between the two looks (see Layers): it glows
+(Settings/SGGlowSwitch), its ⓘ says what it changes, and flipping it offers to restart Spotify.
The pages show only what the stored look has: a page opened after flipping the switch already shows
what the restart will bring. Then a card of parts. Navbar: the tab editor of the stored look, each with
its own list of tabs. Player: Gestures, Lyrics (Apple Music style, the lock screen, in the native look
diff --git a/tweak/Sources/App/Pages.m b/tweak/Sources/App/Pages.m
index 0d571ffd..ee97ca6b 100644
--- a/tweak/Sources/App/Pages.m
+++ b/tweak/Sources/App/Pages.m
@@ -1,5 +1,6 @@
#import "Core/SGCore.h"
#import "Settings/SGModPage.h"
+#import "Settings/SGPageStyle.h"
#import "Pages.h"
#import "Shared/ArtistBlock/ArtistBlock.h"
#import "Shared/Gestures/Gestures.h"
@@ -10,20 +11,35 @@
#import "Native/NowPlayingBar/NowPlayingBar.h"
#import "Native/Player/NowPlaying.h"
#import "Redesigned/Navbar/Navbar.h"
+#import "Redesigned/Kit/SGRAccent.h"
-NSString *const SGRedesignedUIInfo = @"Replaces Spotify's own look with the mod's redesign, built in Liquid Glass: the glass tab bar, search field and now playing bar, the full screen player with the lyrics under it, Spotify's own glass bars and sheets, and every screen redesigned later.\n\nThe redesign starts from a clean sheet: the switches that change Spotify's own screens (the player, Home, playlists, albums, artists, AMOLED and the accent colour) are put away while it is on, and none of them runs. What works the same with either look stays: ads and privacy, lyrics sources, gestures, blocked artists.\n\nChanges apply after you restart Spotify.";
+NSString *const SGRedesignedUIInfo = @"Replaces Spotify's own look with the mod's redesign, built in Liquid Glass: the glass tab bar, search field and now playing bar, the full screen player with the lyrics under it, Spotify's own glass bars and sheets, and every screen redesigned later.\n\nThe redesign starts from a clean sheet: it is black throughout, it has an accent colour of its own, and the switches that change Spotify's own screens (the player, Home, playlists, albums, artists, AMOLED) are put away while it is on, and none of them runs. What works the same with either look stays: ads and privacy, lyrics sources, gestures, blocked artists.\n\nChanges apply after you restart Spotify.";
void SGSetRedesignedUI(BOOL on) {
SGSetEnabled(SGKeyRedesign, on);
}
+// The whole look changes hands at launch, so the switch asks for the restart straight away rather than
+// leaving Spotify half in the old look.
+static void offerRestart(BOOL on) {
+ UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Restart Spotify"
+ message:on ? @"The redesign takes over when Spotify starts again. Spotify closes now; open it again to see it." : @"Spotify's own look comes back when Spotify starts again. Spotify closes now; open it again to see it."
+ preferredStyle:UIAlertControllerStyleAlert];
+ [alert addAction:[UIAlertAction actionWithTitle:@"Later" style:UIAlertActionStyleCancel handler:nil]];
+ [alert addAction:[UIAlertAction actionWithTitle:@"Restart now" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { SGRestartSpotify(); }]];
+ [SGTopController() presentViewController:alert animated:YES completion:nil];
+}
+
SGModSection *SGAppearanceSection(void) {
SGModRow *redesign = SGOptionRow(@"Redesigned UI", @"The mod's own look in Liquid Glass, from a clean sheet", SGKeyRedesign);
redesign.glows = YES;
redesign.info = SGRedesignedUIInfo;
- redesign.changed = ^(BOOL on) { SGSetRedesignedUI(on); };
+ redesign.changed = ^(BOOL on) {
+ SGSetRedesignedUI(on);
+ offerRestart(on);
+ };
NSMutableArray<SGModRow *> *rows = [NSMutableArray arrayWithObject:SGWithSymbol(redesign, @"sparkles")];
- if (!SGRedesignedUIStored()) [rows addObjectsFromArray:SGNativeAppearanceRows()];
+ [rows addObjectsFromArray:SGRedesignedUIStored() ? SGRAppearanceRows() : SGNativeAppearanceRows()];
return SGNotedSection(@"Appearance", rows, @"Changes apply after you restart Spotify.");
}
diff --git a/tweak/Sources/Redesigned/Kit/SGRAccent.h b/tweak/Sources/Redesigned/Kit/SGRAccent.h
new file mode 100644
index 00000000..ab90a7af
--- /dev/null
+++ b/tweak/Sources/Redesigned/Kit/SGRAccent.h
@@ -0,0 +1,12 @@
+// The redesign's accent colour in place of Spotify's green (SGRAccent.x), chosen apart from the native
+// look's and stored under its own key; unset or negative keeps Spotify's own green.
+#import <UIKit/UIKit.h>
+
+#define SGRKeyAccent @"spotifyglass.redesign.accent" // 0xRRGGBB
+
+UIColor *SGRAccentColor(void); // nil while Spotify's own green is kept
+NSString *SGRAccentLabel(void); // "#RRGGBB", or the name of Spotify's own
+void SGRPickAccent(void); // the system colour picker over the top of the app, stored on the way out
+
+@class SGModRow;
+NSArray<SGModRow *> *SGRAppearanceRows(void); // the accent colour, for the Appearance card
diff --git a/tweak/Sources/Redesigned/Kit/SGRAccent.x b/tweak/Sources/Redesigned/Kit/SGRAccent.x
new file mode 100644
index 00000000..f7e79f1c
--- /dev/null
+++ b/tweak/Sources/Redesigned/Kit/SGRAccent.x
@@ -0,0 +1,172 @@
+// The redesign's accent colour, chosen apart from the native look's: its copy of Native/Appearance/Accent.x.
+// Accent colour: Spotify's green, #1ED760, is one token. Its three components occur once in the
+// whole binary, and every green the app draws, from the play button to the "Zobrazit vše" links
+// and the progress bar, is that token or a state blended from it. So it is swapped where it is
+// born, in the UIColor initialiser, and the blends follow. Lottie animations carry their own green
+// and are caught at the layer, below. Image assets with green baked in, the logo above all, are
+// out of reach.
+#import "Core/SGCore.h"
+#import "SGRAccent.h"
+#import "Settings/SGPageStyle.h"
+
+// The greens the app is known to build from literals: the token, and the older brand green the
+// upsell backend still names.
+static const uint32_t kGreens[] = {0x1ED760, 0x1DB954};
+
+static NSInteger sg_accent = -1; // 0xRRGGBB once chosen, read at launch
+
+static NSInteger chosen(void) {
+ NSInteger rgb = SGInt(SGRKeyAccent, -1);
+ return rgb >= 0 && rgb <= 0xFFFFFF ? rgb : -1;
+}
+
+static void unpack(uint32_t rgb, CGFloat *r, CGFloat *g, CGFloat *b) {
+ *r = ((rgb >> 16) & 0xFF) / 255.0;
+ *g = ((rgb >> 8) & 0xFF) / 255.0;
+ *b = (rgb & 0xFF) / 255.0;
+}
+
+UIColor *SGRAccentColor(void) {
+ NSInteger rgb = chosen();
+ if (rgb < 0) return nil;
+ CGFloat r, g, b;
+ unpack((uint32_t)rgb, &r, &g, &b);
+ return [UIColor colorWithRed:r green:g blue:b alpha:1];
+}
+
+NSString *SGRAccentLabel(void) {
+ NSInteger rgb = chosen();
+ return rgb < 0 ? @"Spotify green" : [NSString stringWithFormat:@"#%06lX", (long)rgb];
+}
+
+#pragma mark - picker
+
+@interface SGRAccentPicker : NSObject <UIColorPickerViewControllerDelegate>
+@end
+
+@implementation SGRAccentPicker
+
+- (void)colorPickerViewControllerDidFinish:(UIColorPickerViewController *)picker {
+ CGFloat r = 0, g = 0, b = 0, a = 0;
+ [picker.selectedColor getRed:&r green:&g blue:&b alpha:&a];
+ uint32_t rgb = ((uint32_t)lround(MIN(1, MAX(0, r)) * 255) << 16)
+ | ((uint32_t)lround(MIN(1, MAX(0, g)) * 255) << 8)
+ | (uint32_t)lround(MIN(1, MAX(0, b)) * 255);
+ SGSetInt(SGRKeyAccent, rgb);
+}
+
+@end
+
+void SGRPickAccent(void) {
+ static SGRAccentPicker *delegate;
+ if (!delegate) delegate = [SGRAccentPicker new];
+ UIColorPickerViewController *picker = [UIColorPickerViewController new];
+ picker.supportsAlpha = NO;
+ picker.selectedColor = SGRAccentColor() ?: [UIColor colorWithRed:0x1E / 255.0 green:0xD7 / 255.0 blue:0x60 / 255.0 alpha:1];
+ picker.delegate = delegate;
+ [SGTopController() presentViewController:picker animated:YES completion:nil];
+}
+
+// A darker green than the token comes out as the accent darkened by the same amount, so the two
+// keep their relation.
+static BOOL swap(CGFloat *r, CGFloat *g, CGFloat *b) {
+ for (size_t i = 0; i < sizeof(kGreens) / sizeof(kGreens[0]); i++) {
+ CGFloat gr, gg, gb;
+ unpack(kGreens[i], &gr, &gg, &gb);
+ if (fabs(*r - gr) > 0.01 || fabs(*g - gg) > 0.01 || fabs(*b - gb) > 0.01) continue;
+ CGFloat ar, ag, ab;
+ unpack((uint32_t)sg_accent, &ar, &ag, &ab);
+ CGFloat factor = MAX(gr, MAX(gg, gb)) / (0xD7 / 255.0);
+ *r = MIN(1, ar * factor);
+ *g = MIN(1, ag * factor);
+ *b = MIN(1, ab * factor);
+ return YES;
+ }
+ return NO;
+}
+
+%hook UIColor
+- (UIColor *)initWithRed:(CGFloat)r green:(CGFloat)g blue:(CGFloat)b alpha:(CGFloat)a {
+ swap(&r, &g, &b);
+ return %orig(r, g, b, a);
+}
++ (UIColor *)colorWithRed:(CGFloat)r green:(CGFloat)g blue:(CGFloat)b alpha:(CGFloat)a {
+ swap(&r, &g, &b);
+ return %orig(r, g, b, a);
+}
+%end
+
+// Lottie draws its animations, the play indicator and the checkmarks among them, from colours
+// in the animation file straight onto shape layers, or into colour keyframes, never through
+// UIColor. The same swap goes on the CGColor. Layers get set off the main thread too, so the
+// copy is made with CoreGraphics alone; NULL when the colour is not one of the greens.
+static CGColorRef swappedCopy(CGColorRef color) {
+ if (!color || CFGetTypeID(color) != CGColorGetTypeID() || CGColorGetNumberOfComponents(color) != 4) return NULL;
+ const CGFloat *c = CGColorGetComponents(color);
+ CGFloat r = c[0], g = c[1], b = c[2];
+ if (!swap(&r, &g, &b)) return NULL;
+ CGFloat out[] = {r, g, b, c[3]};
+ return CGColorCreate(CGColorGetColorSpace(color), out);
+}
+
+static id swappedValue(id value) {
+ CGColorRef swapped = swappedCopy((__bridge CGColorRef)value);
+ if (!swapped) return value;
+ id boxed = (__bridge_transfer id)swapped;
+ return boxed;
+}
+
+%hook CAShapeLayer
+- (void)setFillColor:(CGColorRef)color {
+ CGColorRef swapped = swappedCopy(color);
+ CGColorRef used = swapped ?: color;
+ %orig(used);
+ if (swapped) CGColorRelease(swapped);
+}
+- (void)setStrokeColor:(CGColorRef)color {
+ CGColorRef swapped = swappedCopy(color);
+ CGColorRef used = swapped ?: color;
+ %orig(used);
+ if (swapped) CGColorRelease(swapped);
+}
+%end
+
+%hook CALayer
+- (void)setBackgroundColor:(CGColorRef)color {
+ CGColorRef swapped = swappedCopy(color);
+ CGColorRef used = swapped ?: color;
+ %orig(used);
+ if (swapped) CGColorRelease(swapped);
+}
+%end
+
+%hook CABasicAnimation
+- (void)setFromValue:(id)value {
+ id used = swappedValue(value);
+ %orig(used);
+}
+- (void)setToValue:(id)value {
+ id used = swappedValue(value);
+ %orig(used);
+}
+%end
+
+%hook CAKeyframeAnimation
+- (void)setValues:(NSArray *)values {
+ NSMutableArray *mapped = nil;
+ for (NSUInteger i = 0; i < values.count; i++) {
+ id swapped = swappedValue(values[i]);
+ if (swapped == values[i] && !mapped) continue;
+ if (!mapped) mapped = [values mutableCopy];
+ mapped[i] = swapped;
+ }
+ NSArray *used = mapped ?: values;
+ %orig(used);
+}
+%end
+
+%ctor {
+ if (!SGRedesignedUI()) return;
+ sg_accent = chosen();
+ if (sg_accent >= 0) %init;
+}
diff --git a/tweak/Sources/Redesigned/Kit/SGRAmoled.x b/tweak/Sources/Redesigned/Kit/SGRAmoled.x
new file mode 100644
index 00000000..f6696f36
--- /dev/null
+++ b/tweak/Sources/Redesigned/Kit/SGRAmoled.x
@@ -0,0 +1,68 @@
+// The redesign's AMOLED background, always on: its copy of Native/Appearance/Amoled.x without the switch.
+// AMOLED background: Spotify paints its base surface #121212; with the switch on, that grey and
+// the gradients fading into it go pure black. Lighter greys stay (#1F1F1F placeholders, #292929
+// cards), so elevated surfaces still read against the black.
+//
+// Trees: #121212 sits on the Home, Search, Library and settings scroll views, on list rows, the
+// message bar and the player's bottom gradient view.
+#import "Core/SGCore.h"
+
+// Neutral and darker than #1A1A1A, but not already black.
+static BOOL isBaseGrey(CGColorRef color) {
+ if (!color || CFGetTypeID(color) != CGColorGetTypeID()) return NO;
+ const CGFloat *c = CGColorGetComponents(color);
+ size_t n = CGColorGetNumberOfComponents(color);
+ if (n == 2) return c[0] > 0.01 && c[0] <= 0.10;
+ if (n < 3) return NO;
+ return c[0] > 0.01 && c[0] <= 0.10 && fabs(c[0] - c[1]) < 0.02 && fabs(c[1] - c[2]) < 0.02;
+}
+
+// Layers get set from background threads too, so no autoreleased UIColor here.
+static CGColorRef copyBlack(CGColorRef color) {
+ return CGColorCreateGenericGray(0, CGColorGetAlpha(color));
+}
+
+%hook CALayer
+- (void)setBackgroundColor:(CGColorRef)color {
+ if (!isBaseGrey(color)) {
+ %orig;
+ return;
+ }
+ CGColorRef black = copyBlack(color);
+ %orig(black);
+ CGColorRelease(black);
+}
+%end
+
+%hook CAGradientLayer
+- (void)setColors:(NSArray *)colors {
+ NSMutableArray *mapped = [[NSMutableArray alloc] initWithCapacity:colors.count];
+ for (id entry in colors) {
+ CGColorRef color = (__bridge CGColorRef)entry;
+ if (!isBaseGrey(color)) {
+ [mapped addObject:entry];
+ continue;
+ }
+ CGColorRef black = copyBlack(color);
+ [mapped addObject:(__bridge id)black];
+ CGColorRelease(black);
+ }
+ %orig(colors ? mapped : nil);
+}
+%end
+
+// Spotify's settings list paints nothing of its own and shows whatever sits under it, which is not
+// the base grey the hooks above turn black. The list is the top surface, so it takes the black.
+%hook _TtC21Settings_PlatformImpl26SettingsListViewController
+- (void)viewDidLayoutSubviews {
+ %orig;
+ for (UIView *sub in ((UIViewController *)self).view.subviews) {
+ if ([sub isKindOfClass:UICollectionView.class]) sub.backgroundColor = UIColor.blackColor;
+ }
+}
+%end
+
+%ctor {
+ if (!SGRedesignedUI()) return;
+ %init;
+}
diff --git a/tweak/Sources/Redesigned/Kit/SGRAppearanceSettings.m b/tweak/Sources/Redesigned/Kit/SGRAppearanceSettings.m
new file mode 100644
index 00000000..c7614d28
--- /dev/null
+++ b/tweak/Sources/Redesigned/Kit/SGRAppearanceSettings.m
@@ -0,0 +1,29 @@
+#import "Core/SGCore.h"
+#import "Settings/SGModPage.h"
+#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.
+static void chooseAccent(void) {
+ if (!SGRAccentColor()) {
+ SGRPickAccent();
+ return;
+ }
+ UIViewController *top = SGTopController();
+ UIAlertController *sheet = [UIAlertController alertControllerWithTitle:@"Accent colour" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
+ [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); }]];
+ [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);
+ sheet.popoverPresentationController.permittedArrowDirections = 0;
+ [top presentViewController:sheet animated:YES completion:nil];
+}
+
+// The redesign's rows of the Appearance card (App/Pages.m). AMOLED has no row: the redesign is always black.
+NSArray<SGModRow *> *SGRAppearanceRows(void) {
+ return @[
+ SGWithSymbol(SGStatActionRow(@"Accent colour", nil, ^NSString *{ return SGRAccentLabel(); }, ^{ chooseAccent(); }), @"paintpalette"),
+ ];
+}
diff --git a/tweak/Sources/Redesigned/Kit/SGRField.h b/tweak/Sources/Redesigned/Kit/SGRField.h
index cb8447b7..a73a3585 100644
--- a/tweak/Sources/Redesigned/Kit/SGRField.h
+++ b/tweak/Sources/Redesigned/Kit/SGRField.h
@@ -2,8 +2,9 @@
// a whole redesigned page, with no card and no seam anywhere. The player's field also carries the
// artwork itself at the top, blurred and dimmed and dissolving into the colour (showsBackdrop).
//
-// Nothing is blurred live and nothing is masked: the view draws a solid colour layer and at most one
-// bitmap layer rendered off the main thread, so it costs one composited layer or two while the page moves. A new colour or bitmap crossfades over
+// Nothing is blurred live and nothing is masked: the view draws a solid colour layer, a black gradient
+// layer (the redesign is AMOLED throughout, fading the colour to black down the page) and at most one
+// bitmap layer rendered off the main thread, so it costs a few composited layers while the page moves. A new colour or bitmap crossfades over
// SGRCrossfade; the same image again is a no-op.
//
// Ownership: the screen that installs a field owns it (usually retained by its superview and an
@@ -16,7 +17,7 @@
extern NSNotificationName const SGRFieldColorDidChangeNotification;
@interface SGRArtworkField : UIView
-// Where the colour and the backdrop reach past the bounds (overscroll, a plane
+// Where the colour, the fade to black and the backdrop reach past the bounds (overscroll, a plane
// that does not clip): positive values draw outside. The field never clips.
@property (nonatomic) UIEdgeInsets bleed;
@property (nonatomic) BOOL showsBackdrop;
diff --git a/tweak/Sources/Redesigned/Kit/SGRField.m b/tweak/Sources/Redesigned/Kit/SGRField.m
index e9a7e645..2c30c7bd 100644
--- a/tweak/Sources/Redesigned/Kit/SGRField.m
+++ b/tweak/Sources/Redesigned/Kit/SGRField.m
@@ -7,6 +7,10 @@ NSNotificationName const SGRFieldColorDidChangeNotification = @"spotifyglass.red
static const CGFloat kFallbackHeight = 874; // a window-less field sizes for an iPhone 17 Pro
+// Where the colour starts fading to black and where it is black, as shares of the window's height:
+// the redesign is AMOLED throughout (SGRAmoled.x).
+static const CGFloat kBlackFrom = 0.55, kBlackTo = 1;
+
static CGFloat windowHeight(UIView *view) {
CGFloat height = view.window.bounds.size.height;
return height > 0 ? height : kFallbackHeight;
@@ -26,6 +30,7 @@ static NSDictionary *noActions(void) {
@implementation SGRArtworkField {
CALayer *_solid;
+ CAGradientLayer *_black;
CALayer *_backdrop;
UIColor *_color;
UIImage *_image;
@@ -46,6 +51,11 @@ static NSDictionary *noActions(void) {
_solid.backgroundColor = _color.CGColor;
[self.layer addSublayer:_solid];
+ _black = [CAGradientLayer layer];
+ _black.actions = noActions();
+ _black.colors = @[(id)[UIColor colorWithWhite:0 alpha:0].CGColor, (id)UIColor.blackColor.CGColor];
+ [self.layer addSublayer:_black];
+
_backdrop = [CALayer layer];
_backdrop.actions = noActions();
_backdrop.contentsGravity = kCAGravityResize;
@@ -80,6 +90,11 @@ static NSDictionary *noActions(void) {
[CATransaction begin];
[CATransaction setDisableActions:YES];
_solid.frame = painted;
+ CGFloat height = windowHeight(self), total = MAX(1, painted.size.height);
+ CGFloat from = height * kBlackFrom + bleed.top;
+ CGFloat to = MAX(from + 1, height * kBlackTo + bleed.top);
+ _black.frame = painted;
+ _black.locations = @[@(MIN(1, from / total)), @(MIN(1, to / total))];
_backdrop.frame = CGRectMake(0, 0, bounds.size.width, [self backdropHeightNow]);
[CATransaction commit];
}
@@ -96,6 +111,7 @@ static NSDictionary *noActions(void) {
if (animated && from) {
CABasicAnimation *fade = [CABasicAnimation animationWithKeyPath:@"backgroundColor"];
fade.fromValue = from;
+ // Read back rather than the colour asked for: SGRAmoled.x may have swapped it for black.
fade.toValue = (__bridge id)_solid.backgroundColor;
fade.duration = SGRCrossfade;
fade.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
@@ -114,7 +130,7 @@ static NSDictionary *noActions(void) {
_image = image;
_identity = [identity copy];
NSUInteger generation = ++_generation;
- SGRPaletteRequest request = {CGSizeZero, NO, NO};
+ SGRPaletteRequest request = {CGSizeZero, NO, YES};
if (_showsBackdrop) request.backdropSize = CGSizeMake(self.bounds.size.width > 0 ? self.bounds.size.width : 402, [self backdropHeightNow]);
__weak SGRArtworkField *weakSelf = self;
[SGRPalette paletteForImage:image request:request completion:^(SGRPalette *palette) {
diff --git a/tweak/Sources/Redesigned/Kit/SGRKit.h b/tweak/Sources/Redesigned/Kit/SGRKit.h
index a085093b..e736a107 100644
--- a/tweak/Sources/Redesigned/Kit/SGRKit.h
+++ b/tweak/Sources/Redesigned/Kit/SGRKit.h
@@ -10,6 +10,7 @@
// SGRRestyle.h keeping Spotify's views restyled: suppress, digits, lookups, shadows, firing controls
// SGRBridges.h player state, now playing artwork, the player's open and close
// SGRRepaint.h the areas the redesign keeps transparent when Spotify repaints them
+// SGRAccent.h the redesign's accent colour; its AMOLED black is SGRAmoled.x, always on
//
// Every hook file of the redesign starts its %ctor with `if (!SGRedesignedUI()) return;` and every one
// of Native/ with `if (!SGNativeUI()) return;` (Core/SGUIMode.h), so the two looks never run together.
@@ -22,3 +23,4 @@
#import "SGRRestyle.h"
#import "SGRBridges.h"
#import "SGRRepaint.h"
+#import "SGRAccent.h"
diff --git a/tweak/Sources/Redesigned/Kit/SGRTokens.h b/tweak/Sources/Redesigned/Kit/SGRTokens.h
index 0c0d3619..10974216 100644
--- a/tweak/Sources/Redesigned/Kit/SGRTokens.h
+++ b/tweak/Sources/Redesigned/Kit/SGRTokens.h
@@ -27,7 +27,7 @@ UIColor *SGRPrimary(void); // white
UIColor *SGRSecondary(void); // white 65%, 80% with Increase Contrast
UIColor *SGRTertiary(void); // white 40%, 60% with Increase Contrast
UIColor *SGRAccent(void); // the accent colour of Appearance, else Spotify's green
-UIColor *SGRNeutralField(void); // #121212, the field before a colour arrives
+UIColor *SGRNeutralField(void); // #121212, the field before a colour arrives; SGRAmoled.x turns it black
// Where glass cannot be (Reduce Transparency), the shape it would have had: white 16% over the field.
UIColor *SGRSolidGlassFill(void);
// A content surface on the field (a card), a step lighter than the field it sits on.
diff --git a/tweak/Sources/Redesigned/Kit/SGRTokens.m b/tweak/Sources/Redesigned/Kit/SGRTokens.m
index cc2c8f3c..a0f4911b 100644
--- a/tweak/Sources/Redesigned/Kit/SGRTokens.m
+++ b/tweak/Sources/Redesigned/Kit/SGRTokens.m
@@ -1,6 +1,7 @@
#import <CoreText/SFNTLayoutTypes.h>
#import "Core/SGCore.h"
#import "SGRTokens.h"
+#import "SGRAccent.h"
const CGFloat SGRSideMargin = 16;
const CGFloat SGRGrid = 8;
@@ -30,9 +31,9 @@ UIColor *SGRTertiary(void) {
return [UIColor colorWithWhite:1 alpha:SGRIncreaseContrast() ? 0.60 : 0.40];
}
-// Spotify's green: the accent colour is the native look's.
+// Read per call: the accent is stored as it is picked, and the colour row reads it the same way.
UIColor *SGRAccent(void) {
- return [UIColor colorWithRed:0x1E / 255.0 green:0xD7 / 255.0 blue:0x60 / 255.0 alpha:1];
+ return SGRAccentColor() ?: [UIColor colorWithRed:0x1E / 255.0 green:0xD7 / 255.0 blue:0x60 / 255.0 alpha:1];
}
UIColor *SGRNeutralField(void) {
@@ -46,7 +47,7 @@ UIColor *SGRSolidGlassFill(void) {
UIColor *SGRElevated(UIColor *field) {
CGFloat r = 0, g = 0, b = 0, a = 1;
if (![field getRed:&r green:&g blue:&b alpha:&a]) return [UIColor colorWithWhite:1 alpha:0.08];
- // 12% towards white keeps a card clear of a dark field.
+ // 12% towards white keeps a card on a black field clear of the greys SGRAmoled.x turns black.
CGFloat lift = 0.12;
return [UIColor colorWithRed:r + (1 - r) * lift green:g + (1 - g) * lift blue:b + (1 - b) * lift alpha:1];
}
diff --git a/tweak/Sources/Settings/SGPageStyle.m b/tweak/Sources/Settings/SGPageStyle.m
index 7a7f457a..884277e5 100644
--- a/tweak/Sources/Settings/SGPageStyle.m
+++ b/tweak/Sources/Settings/SGPageStyle.m
@@ -67,27 +67,28 @@ void SGInsetForBars(UITableView *table) {
table.verticalScrollIndicatorInsets = inset;
}
-// The pages follow the native look's AMOLED and accent switches (Native/Appearance), read here by their
-// keys so the page framework depends on no layer. Under Redesigned UI those switches are put away, and
-// the pages keep Spotify's own colours.
+// The pages follow the running look's black and accent colour, read here by their keys so the page
+// framework depends on no layer: the native look's AMOLED switch and accent (Native/Appearance), or the
+// redesign's accent (Redesigned/Kit/SGRAccent.h), which is always black.
static NSString *const kAmoledKey = @"spotifyglass.amoled";
static NSString *const kAccentKey = @"spotifyglass.accent";
+static NSString *const kRedesignAccentKey = @"spotifyglass.redesign.accent";
-static UIColor *nativeAccent(void) {
- NSInteger rgb = SGNativeUI() ? SGInt(kAccentKey, -1) : -1;
+static UIColor *lookAccent(void) {
+ NSInteger rgb = SGInt(SGRedesignedUI() ? kRedesignAccentKey : kAccentKey, -1);
if (rgb < 0 || rgb > 0xFFFFFF) return nil;
return [UIColor colorWithRed:((rgb >> 16) & 0xFF) / 255.0 green:((rgb >> 8) & 0xFF) / 255.0 blue:(rgb & 0xFF) / 255.0 alpha:1];
}
-static BOOL nativeAmoled(void) {
- return SGNativeUI() && SGFlag(kAmoledKey, NO);
+static BOOL lookBlack(void) {
+ return SGRedesignedUI() || SGFlag(kAmoledKey, NO);
}
-UIColor *SGGreen(void) { return nativeAccent() ?: [UIColor colorWithRed:0x1E / 255.0 green:0xD7 / 255.0 blue:0x60 / 255.0 alpha:1]; }
+UIColor *SGGreen(void) { return lookAccent() ?: [UIColor colorWithRed:0x1E / 255.0 green:0xD7 / 255.0 blue:0x60 / 255.0 alpha:1]; }
UIColor *SGRed(void) { return [UIColor colorWithRed:0xF1 / 255.0 green:0x5E / 255.0 blue:0x6B / 255.0 alpha:1]; }
-UIColor *SGPageBackground(void) { return nativeAmoled() ? UIColor.blackColor : [UIColor colorWithWhite:0x12 / 255.0 alpha:1]; }
+UIColor *SGPageBackground(void) { return lookBlack() ? UIColor.blackColor : [UIColor colorWithWhite:0x12 / 255.0 alpha:1]; }
// Spotify's own elevated grey on its dark grey; iOS's own card grey on the AMOLED black.
-UIColor *SGCardBackground(void) { return [UIColor colorWithWhite:(nativeAmoled() ? 0x1C : 0x2A) / 255.0 alpha:1]; }
+UIColor *SGCardBackground(void) { return [UIColor colorWithWhite:(lookBlack() ? 0x1C : 0x2A) / 255.0 alpha:1]; }
UIImage *SGTileImage(NSString *symbol) {
UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:14 weight:UIImageSymbolWeightMedium];