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: Mod Settings lays its pages out in cards like system Settings

My-Name-Is-Jeffbd6e585abc93
diff --git a/docs/tweaks.md b/docs/tweaks.md
index c36d4526..5cb7678c 100644
--- a/docs/tweaks.md
+++ b/docs/tweaks.md
@@ -10,7 +10,7 @@
tweak/Sources/Settings/ the Mod Settings framework: SGPage (a page on Spotify's stack), SGModPage (sections
of rows: switches, choices, sliders, links, rows shown only while a choice
asks for them, and rows greyed out while the switch they wait on is off, a tap
- on one nudging that switch), SGPageStyle (Spotify's list look), SGGlowSwitch
+ on one nudging that switch), SGPageStyle (the system Settings look), SGGlowSwitch
tweak/Sources/Shared/ what works the same with either look, see Layers below
tweak/Sources/Native/ tweaks on Spotify's own screens, running only while Redesigned UI is off
tweak/Sources/Redesigned/ the redesign, running only while Redesigned UI is on
@@ -403,7 +403,10 @@ and Live Activity. The root page in `App/ModSettings.x` links the Appearance pag
## Mod Settings
Mod Settings, opened by holding Home on the tab bar or from the first row of the side drawer and the
-last row of Spotify's Settings, sorts every
+last row of Spotify's Settings, looks like the system Settings app in its dark appearance under either look:
+cards of #1C1C1E on black, 17pt rows that follow Dynamic Type up to xxxLarge and the app font, each part of
+Spotify behind a symbol on a tile of its own colour, grey chevrons and footnote headers. It has no account
+page. It 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 row, on a card of its own under the signing warning, which opens the Appearance
diff --git a/harness/haptics-page/main.m b/harness/haptics-page/main.m
index 7f5750c7..aeb7c126 100644
--- a/harness/haptics-page/main.m
+++ b/harness/haptics-page/main.m
@@ -37,10 +37,10 @@ static void findViews(UIView *root, Class kind, NSMutableArray *found) {
SGModRow *blocked = SGPageRow(@"Blocked artists", none);
blocked.value = ^NSString *{ return @"Off"; };
NSMutableArray<SGModSection *> *sections = [NSMutableArray arrayWithArray:@[
- SGSection(nil, @[SGWithSymbol(SGPageRow(@"Gestures", none), @"hand.tap"), SGWithSymbol(SGPageRow(@"Lyrics", none), @"quote.bubble"),
- SGWithSymbol(blocked, @"person.crop.circle.badge.xmark")]),
- SGSection(nil, @[SGWithSymbol(SGPageRow(@"Now playing", none), @"rectangle.bottomthird.inset.filled"),
- SGWithSymbol(SGPageRow(@"Lock screen widget", none), @"lock")]),
+ SGSection(nil, @[SGWithTile(SGPageRow(@"Gestures", none), @"hand.tap", UIColor.systemBlueColor), SGWithTile(SGPageRow(@"Lyrics", none), @"quote.bubble", UIColor.systemPurpleColor),
+ SGWithTile(blocked, @"person.crop.circle.badge.xmark", UIColor.systemRedColor)]),
+ SGSection(nil, @[SGWithTile(SGPageRow(@"Now playing", none), @"rectangle.bottomthird.inset.filled", UIColor.systemPinkColor),
+ SGWithTile(SGPageRow(@"Lock screen widget", none), @"lock", UIColor.systemGrayColor)]),
]];
[sections addObjectsFromArray:SGVibrationsSections()];
return [[SGModPage alloc] initWithTitle:@"Player" intro:@"Changes apply after you restart Spotify. Gestures, Blocked artists and Vibrations apply straight away."
diff --git a/tweak/Sources/App/ModSettings.x b/tweak/Sources/App/ModSettings.x
index dba1ec54..3969314b 100644
--- a/tweak/Sources/App/ModSettings.x
+++ b/tweak/Sources/App/ModSettings.x
@@ -30,8 +30,9 @@
static const CGFloat kRowHeight = 56;
static char kRowKey, kInsetKey;
-static SGModRow *pageRow(NSString *title, NSString *symbol, UIViewController *(^page)(void)) {
- return SGWithSymbol(SGPageRow(title, page), symbol);
+// Each part of Spotify on a tile of its own colour, as Settings lists its own, so a row is found by its colour.
+static SGModRow *pageRow(NSString *title, NSString *symbol, UIColor *color, UIViewController *(^page)(void)) {
+ return SGWithTile(SGPageRow(title, page), symbol, color);
}
static UIViewController *modSettingsPage(void) {
@@ -43,41 +44,41 @@ static UIViewController *modSettingsPage(void) {
SGModRow *signing = SGSigningWarningRow();
if (signing) [sections addObject:SGSection(nil, @[signing])];
// Appearance opens a page of its own, on a card of its own, so the parts below stay one tap from the top.
- [sections addObject:SGSection(nil, @[pageRow(@"Appearance", @"paintpalette", ^UIViewController *{ return SGAppearancePage(); })])];
- SGModRow *mod = pageRow(@"Mod", @"info.circle", ^UIViewController *{ return SGAboutPage(); });
+ [sections addObject:SGSection(nil, @[pageRow(@"Appearance", @"paintpalette", UIColor.systemBlueColor, ^UIViewController *{ return SGAppearancePage(); })])];
+ SGModRow *mod = pageRow(@"Mod", @"info.circle", UIColor.systemGrayColor, ^UIViewController *{ return SGAboutPage(); });
mod.value = ^NSString *{ return @(SG_VERSION); };
// The audio effects work on the sound, so both looks have them, with what they are doing beside the chevron.
- SGModRow *audioEffects = pageRow(@"Audio effects", @"slider.vertical.3", ^UIViewController *{ return SGDSPSettingsPage(); });
+ SGModRow *audioEffects = pageRow(@"Audio effects", @"slider.vertical.3", UIColor.systemOrangeColor, ^UIViewController *{ return SGDSPSettingsPage(); });
audioEffects.value = ^NSString *{ return SGDSPSummary(); };
// Sing works on the sound, so both looks have it, saying beside the chevron whether it is on or how far its
// voice model has come.
- SGModRow *sing = pageRow(@"Sing", @"music.mic", ^UIViewController *{ return SGSingSettingsPage(); });
+ SGModRow *sing = pageRow(@"Sing", @"music.mic", UIColor.systemRedColor, ^UIViewController *{ return SGSingSettingsPage(); });
sing.value = ^NSString *{ return SGSingSummary(); };
// Home & Library holds only the native look's switches, so the redesign has no such page; the
// Live Activity works under both, and only where ActivityKit's card does.
NSMutableArray<SGModRow *> *parts = [NSMutableArray arrayWithArray:@[
- pageRow(@"Navbar", @"dock.rectangle", ^UIViewController *{ return SGNavbarPage(); }),
- pageRow(@"Player", @"play.circle", ^UIViewController *{ return SGPlayerSettingsPage(); }),
- pageRow(@"Lyrics", @"quote.bubble", ^UIViewController *{ return SGLyricsSettingsPage(); }),
+ pageRow(@"Navbar", @"dock.rectangle", UIColor.systemIndigoColor, ^UIViewController *{ return SGNavbarPage(); }),
+ pageRow(@"Player", @"play.circle", UIColor.systemPinkColor, ^UIViewController *{ return SGPlayerSettingsPage(); }),
+ pageRow(@"Lyrics", @"quote.bubble", UIColor.systemPurpleColor, ^UIViewController *{ return SGLyricsSettingsPage(); }),
sing,
audioEffects,
]];
if (@available(iOS 17.0, *)) {
- SGModRow *liveActivity = pageRow(@"Live Activity", @"platter.filled.top.iphone", ^UIViewController *{ return SGLiveActivitySettingsPage(); });
+ SGModRow *liveActivity = pageRow(@"Live Activity", @"platter.filled.top.iphone", UIColor.systemTealColor, ^UIViewController *{ return SGLiveActivitySettingsPage(); });
liveActivity.value = ^NSString *{ return SGLiveActivitySummary(); };
[parts addObject:liveActivity];
}
- [parts addObject:pageRow(@"Listening stats", @"chart.bar", ^UIViewController *{ return SGListeningStatsPage(); })];
- if (!SGRedesignedUIStored()) [parts addObject:pageRow(@"Home & Library", @"house", ^UIViewController *{ return SGHomeSettingsPage(); })];
- else [parts addObject:pageRow(@"Albums & artists", @"square.stack", ^UIViewController *{ return SGRAlbumSettingsPage(); })];
+ [parts addObject:pageRow(@"Listening stats", @"chart.bar", UIColor.systemGreenColor, ^UIViewController *{ return SGListeningStatsPage(); })];
+ if (!SGRedesignedUIStored()) [parts addObject:pageRow(@"Home & Library", @"house", UIColor.systemCyanColor, ^UIViewController *{ return SGHomeSettingsPage(); })];
+ else [parts addObject:pageRow(@"Albums & artists", @"square.stack", UIColor.systemCyanColor, ^UIViewController *{ return SGRAlbumSettingsPage(); })];
[sections addObjectsFromArray:@[
SGSection(nil, parts),
SGSection(nil, @[
- pageRow(@"Premium, ads & privacy", @"crown", ^UIViewController *{ return SGAdsSettingsPage(); }),
- pageRow(@"Labs", @"testtube.2", ^UIViewController *{ return SGLabsPage(); }),
+ pageRow(@"Premium, ads & privacy", @"crown", UIColor.systemBlueColor, ^UIViewController *{ return SGAdsSettingsPage(); }),
+ pageRow(@"Labs", @"testtube.2", UIColor.systemMintColor, ^UIViewController *{ return SGLabsPage(); }),
]),
SGSection(nil, @[
- pageRow(@"All flags", @"flag", ^UIViewController *{ return SGAllFlagsPage(); }),
+ pageRow(@"All flags", @"flag", UIColor.systemGrayColor, ^UIViewController *{ return SGAllFlagsPage(); }),
mod,
]),
]];
@@ -112,7 +113,7 @@ static UIViewController *modSettingsPage(void) {
- (void)layoutSubviews {
[super layoutSubviews];
- _title.font = SGTitleFont();
+ _title.font = SGSpotifyListFont();
CGFloat width = self.bounds.size.width, height = self.bounds.size.height, lead = self.drawer ? 4 : 0;
_icon.frame = CGRectMake(12 + lead, (height - 24) / 2, 24, 24);
_title.frame = CGRectMake(48 + lead, 0, width - 96, height);
diff --git a/tweak/Sources/App/Pages.m b/tweak/Sources/App/Pages.m
index 5a3e21e4..efd735a1 100644
--- a/tweak/Sources/App/Pages.m
+++ b/tweak/Sources/App/Pages.m
@@ -52,7 +52,7 @@ static SGModRow *unavailableRow(void) {
[alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil]];
[SGTopController() presentViewController:alert animated:YES completion:nil];
});
- return SGWithSymbol(row, @"sparkles");
+ return SGWithTile(row, @"sparkles", UIColor.systemPurpleColor);
}
// Redesigned UI, then the stored look's own rows (below iOS 26 that is always the native look's), then the
@@ -67,7 +67,7 @@ UIViewController *SGAppearancePage(void) {
SGSetRedesignedUI(on);
offerRestart(on);
};
- look = SGWithSymbol(redesign, @"sparkles");
+ look = SGWithTile(redesign, @"sparkles", UIColor.systemPurpleColor);
}
NSMutableArray<SGModRow *> *everywhere = [NSMutableArray arrayWithArray:SGAppFontRows()];
SGModRow *icon = SGAppIconRow();
@@ -90,7 +90,7 @@ static UIViewController *lyricsPage(void) {
if (!redesigned) [more insertObject:SGGlassLyricsRow() atIndex:0];
SGModRow *sing = SGPageRow(@"Sing", ^UIViewController *{ return SGSingSettingsPage(); });
sing.value = ^NSString *{ return SGSingSummary(); };
- NSMutableArray<SGModSection *> *sections = [NSMutableArray arrayWithObjects:SGSection(nil, @[SGWithSymbol(sing, @"music.mic")]),
+ NSMutableArray<SGModSection *> *sections = [NSMutableArray arrayWithObjects:SGSection(nil, @[SGWithTile(sing, @"music.mic", UIColor.systemRedColor)]),
SGLyricsSourcesSection(redesigned), nil];
if (redesigned) {
[sections addObject:SGSection(@"Display", @[SGLyricsWordTimingRow(), SGRLyricsTextSizesRow(), SGLyricsTranslationLanguageRow(), SGLyricsMeaningsRow(),
@@ -117,16 +117,16 @@ UIViewController *SGPlayerSettingsPage(void) {
BOOL native = !SGRedesignedUIStored();
NSMutableArray<SGModSection *> *sections = [NSMutableArray arrayWithObject:SGSection(nil, @[
- SGWithSymbol(SGPageRow(@"Gestures", ^UIViewController *{ return SGGesturesSettingsPage(); }), @"hand.tap"),
- SGWithSymbol(SGPageRow(@"AirPods gestures", ^UIViewController *{ return SGHeadGesturesSettingsPage(); }), @"airpods.pro"),
- SGWithSymbol(blocked, @"person.crop.circle.badge.xmark"),
+ SGWithTile(SGPageRow(@"Gestures", ^UIViewController *{ return SGGesturesSettingsPage(); }), @"hand.tap", UIColor.systemBlueColor),
+ SGWithTile(SGPageRow(@"AirPods gestures", ^UIViewController *{ return SGHeadGesturesSettingsPage(); }), @"airpods.pro", UIColor.systemGrayColor),
+ SGWithTile(blocked, @"person.crop.circle.badge.xmark", UIColor.systemRedColor),
])];
NSMutableArray<SGModRow *> *pages = [NSMutableArray array];
if (native) {
- [pages addObject:SGWithSymbol(SGPageRow(@"Now playing bar", ^UIViewController *{ return SGNowPlayingBarSettingsPage(); }), @"rectangle.bottomthird.inset.filled")];
- [pages addObject:SGWithSymbol(SGPageRow(@"Queue & devices", ^UIViewController *{ return SGQueueSettingsPage(); }), @"text.line.first.and.arrowtriangle.forward")];
+ [pages addObject:SGWithTile(SGPageRow(@"Now playing bar", ^UIViewController *{ return SGNowPlayingBarSettingsPage(); }), @"rectangle.bottomthird.inset.filled", UIColor.systemPinkColor)];
+ [pages addObject:SGWithTile(SGPageRow(@"Queue & devices", ^UIViewController *{ return SGQueueSettingsPage(); }), @"text.line.first.and.arrowtriangle.forward", UIColor.systemIndigoColor)];
}
- [pages addObject:SGWithSymbol(SGPageRow(@"Lock screen widget", ^UIViewController *{ return SGLockScreenWidgetPage(); }), @"lock")];
+ [pages addObject:SGWithTile(SGPageRow(@"Lock screen widget", ^UIViewController *{ return SGLockScreenWidgetPage(); }), @"lock", UIColor.systemGrayColor)];
[sections addObject:SGSection(nil, pages)];
if (native) [sections addObjectsFromArray:SGNativePlayerScreenSections()];
// Switch to video is the same chip of Spotify's player under either look.
diff --git a/tweak/Sources/Settings/SGModPage.h b/tweak/Sources/Settings/SGModPage.h
index 792f7472..948f47a0 100644
--- a/tweak/Sources/Settings/SGModPage.h
+++ b/tweak/Sources/Settings/SGModPage.h
@@ -22,6 +22,7 @@
@property (nonatomic, copy) void (^changed)(BOOL on); // after the switch is stored; the page reloads
@property (nonatomic, strong) UIColor *color; // title, subtitle and symbol, for a warning row
@property (nonatomic, copy) NSString *symbol;
+@property (nonatomic, strong) UIColor *tint; // the square under the symbol, grey when nil (SGWithTile)
// A switch row that changes the whole app draws SGGlowSwitch instead of a UISwitch.
@property (nonatomic) BOOL glows;
// An ⓘ button beside the row's switch, whose tap reads this out under the row's title.
@@ -97,5 +98,7 @@ SGModRow *SGLinkRow(NSString *title, NSString *subtitle, NSString *url);
SGModRow *SGStatActionRow(NSString *title, NSString *subtitle, NSString *(^value)(void), void (^action)(void));
SGModSection *SGSection(NSString *title, NSArray<SGModRow *> *rows);
SGModSection *SGNotedSection(NSString *title, NSArray<SGModRow *> *rows, NSString *footer);
-// Gives a row its leading symbol, drawn on a tile unless the row has a colour of its own.
+// Gives a row its leading symbol, drawn on a grey tile unless the row has a colour of its own.
SGModRow *SGWithSymbol(SGModRow *row, NSString *symbol);
+// The same on a tile of `color`, the way Settings colours the icon of each of its rows.
+SGModRow *SGWithTile(SGModRow *row, NSString *symbol, UIColor *color);
diff --git a/tweak/Sources/Settings/SGModPage.m b/tweak/Sources/Settings/SGModPage.m
index 55ef38db..8dda7a8a 100644
--- a/tweak/Sources/Settings/SGModPage.m
+++ b/tweak/Sources/Settings/SGModPage.m
@@ -294,6 +294,11 @@ SGModRow *SGWithSymbol(SGModRow *row, NSString *symbol) {
return row;
}
+SGModRow *SGWithTile(SGModRow *row, NSString *symbol, UIColor *color) {
+ row.tint = color;
+ return SGWithSymbol(row, symbol);
+}
+
// What a page row carrying a value shows on the right: the value, then the chevron, the same
// distance apart as Spotify's own rows keep them.
static UIView *valueAndChevron(NSString *text) {
@@ -302,7 +307,7 @@ static UIView *valueAndChevron(NSString *text) {
label.textColor = SGGrey();
label.text = text;
[label sizeToFit];
- UIImageView *chevron = SGSymbolView(@"chevron.right", 13, UIImageSymbolWeightSemibold, 16);
+ UIImageView *chevron = SGChevronView();
CGFloat height = MAX(label.bounds.size.height, chevron.bounds.size.height);
UIView *box = [[UIView alloc] initWithFrame:CGRectMake(0, 0, label.bounds.size.width + 6 + chevron.bounds.size.width, height)];
label.center = CGPointMake(label.bounds.size.width / 2, height / 2);
@@ -414,10 +419,14 @@ static UIFont *tabular(UIFont *font) {
BOOL _detents; // few enough steps that the thumb jumps between them as it is dragged
}
-static const CGFloat kSliderTop = 12, kSliderLine = 18, kSliderSubtitle = 14, kSliderGap = 6, kSliderHeight = 28, kSliderBottom = 10;
+static const CGFloat kSliderTop = 12, kSliderGap = 6, kSliderHeight = 28, kSliderBottom = 10;
+
+// The lines are as tall as Dynamic Type makes the fonts.
+static CGFloat titleLine(void) { return ceil(SGTitleFont().lineHeight); }
+static CGFloat subtitleLine(void) { return ceil(SGSubtitleFont().lineHeight); }
+ (CGFloat)heightFor:(SGModRow *)row {
- return kSliderTop + kSliderLine + (row.subtitle ? kSliderSubtitle : 0) + kSliderGap + kSliderHeight + kSliderBottom;
+ return kSliderTop + titleLine() + (row.subtitle ? subtitleLine() : 0) + kSliderGap + kSliderHeight + kSliderBottom;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)identifier {
@@ -475,12 +484,12 @@ static const CGFloat kSliderTop = 12, kSliderLine = 18, kSliderSubtitle = 14, kS
CGFloat width = self.contentView.bounds.size.width, side = 16, y = kSliderTop;
[_value sizeToFit];
CGFloat valueWidth = MAX(_value.bounds.size.width, 44);
- _value.frame = CGRectMake(width - side - valueWidth, y, valueWidth, kSliderLine);
- _title.frame = CGRectMake(side, y, CGRectGetMinX(_value.frame) - side - 8, kSliderLine);
- y += kSliderLine;
+ _value.frame = CGRectMake(width - side - valueWidth, y, valueWidth, titleLine());
+ _title.frame = CGRectMake(side, y, CGRectGetMinX(_value.frame) - side - 8, titleLine());
+ y += titleLine();
if (_row.subtitle) {
- _subtitle.frame = CGRectMake(side, y, width - 2 * side, kSliderSubtitle);
- y += kSliderSubtitle;
+ _subtitle.frame = CGRectMake(side, y, width - 2 * side, subtitleLine());
+ y += subtitleLine();
}
_slider.frame = CGRectMake(side, y + kSliderGap, width - 2 * side, kSliderHeight);
}
@@ -793,9 +802,9 @@ static void showWaiting(UITableViewCell *cell, BOOL waiting, NSString *switchTit
UIListContentConfiguration *content = (UIListContentConfiguration *)cell.contentConfiguration;
if (row.color) content.secondaryTextProperties.color = row.color;
BOOL tile = row.symbol && !row.color;
- if (tile) content.image = SGTileImage(row.symbol);
+ if (tile) content.image = row.tint ? SGTileImageTinted(row.symbol, row.tint) : SGTileImage(row.symbol);
cell.contentConfiguration = content;
- cell.separatorInset = UIEdgeInsetsMake(0, row.symbol ? (tile ? 58 : 48) : 16, 0, 0);
+ cell.separatorInset = UIEdgeInsetsMake(0, row.symbol ? (tile ? SGTileRowInset : 48) : 16, 0, 0);
if (row.key) {
BOOL locked = flagRowLocked(row);
@@ -823,7 +832,7 @@ static void showWaiting(UITableViewCell *cell, BOOL waiting, NSString *switchTit
cell.accessoryView = row.info ? [self infoButtonBeside:toggle] : toggle;
cell.selectionStyle = locked ? UITableViewCellSelectionStyleDefault : UITableViewCellSelectionStyleNone;
} else if (row.page) {
- UIView *link = row.value ? valueAndChevron(row.value()) : SGSymbolView(@"chevron.right", 13, UIImageSymbolWeightSemibold, 16);
+ UIView *link = row.value ? valueAndChevron(row.value()) : SGChevronView();
cell.accessoryView = row.info ? [self infoButtonBeside:link] : link;
cell.selectionStyle = UITableViewCellSelectionStyleDefault;
} else if (row.menu) {
diff --git a/tweak/Sources/Settings/SGPage.m b/tweak/Sources/Settings/SGPage.m
index 5b7e4798..90c6634c 100644
--- a/tweak/Sources/Settings/SGPage.m
+++ b/tweak/Sources/Settings/SGPage.m
@@ -14,7 +14,7 @@ static BOOL sg_pagesConform;
@implementation SGPage
-// Inset grouped cards on Spotify's dark grey, a hairline between the rows of a card.
+// Inset grouped cards on black, the way Settings draws them, a hairline between the rows of a card.
- (void)viewDidLoad {
[super viewDidLoad];
self.overrideUserInterfaceStyle = UIUserInterfaceStyleDark;
diff --git a/tweak/Sources/Settings/SGPageStyle.h b/tweak/Sources/Settings/SGPageStyle.h
index d14eeb4b..56f27560 100644
--- a/tweak/Sources/Settings/SGPageStyle.h
+++ b/tweak/Sources/Settings/SGPageStyle.h
@@ -1,20 +1,29 @@
-// Spotify's own list look, for every page of the mod's: a 13pt white title over an 11pt grey
-// subtitle on #121212, 38pt uppercase section headers, green switches.
+// The system Settings app's look, for every page of the mod's, in its dark appearance: cards of #1C1C1E on
+// black, 17pt titles over 15pt grey subtitles, 13pt uppercase section headers and notes, a white symbol on a
+// coloured rounded square leading a row, switches in the look's accent colour. The text follows Dynamic Type
+// up to the largest size before the accessibility ones, and the app font of Shared/Fonts.
#import <UIKit/UIKit.h>
-UIColor *SGGrey(void);
+UIColor *SGGrey(void); // the secondary label's grey
UIColor *SGGreen(void);
UIColor *SGRed(void);
UIColor *SGPageBackground(void);
UIColor *SGCardBackground(void);
-UIFont *SGTitleFont(void);
-UIFont *SGSubtitleFont(void);
-// Takes the 13pt and 11pt fonts off Spotify's own settings list, once, so the pages match it.
+UIFont *SGTitleFont(void); // a row's title and value, Settings' body
+UIFont *SGSubtitleFont(void); // section headers, footers and notes, Settings' footnote
+// Takes the 13pt title font off Spotify's own settings list, once, for the Mod Settings row the mod adds to it
+// (App/ModSettings.x), which reads as one of Spotify's rows; SGSpotifyListFont hands it out.
void SGAdoptFonts(UIView *list, UIView *exclude);
+UIFont *SGSpotifyListFont(void);
UIImageView *SGSymbolView(NSString *name, CGFloat size, UIImageSymbolWeight weight, CGFloat box);
-// A symbol on a rounded grey square, the leading icon of a row that opens a page.
+// A white symbol on a rounded square of `color`, the leading icon of a row; SGTileImage's square is grey.
+UIImage *SGTileImageTinted(NSString *symbol, UIColor *color);
UIImage *SGTileImage(NSString *symbol);
+// The chevron of a row that opens a page, in the tertiary label's grey.
+UIImageView *SGChevronView(void);
+// The separator inset of a row led by a tile, so the hairline starts under the title as in Settings.
+extern const CGFloat SGTileRowInset;
// A grey note in a wrapper view, for a table header or footer; SGFitNote sizes it to its text.
UIView *SGNote(NSString *text);
void SGFitNote(UITableView *table, UIView *wrapper, CGFloat top, CGFloat bottom);
diff --git a/tweak/Sources/Settings/SGPageStyle.m b/tweak/Sources/Settings/SGPageStyle.m
index 4049ec8d..a9d087e2 100644
--- a/tweak/Sources/Settings/SGPageStyle.m
+++ b/tweak/Sources/Settings/SGPageStyle.m
@@ -1,11 +1,22 @@
#import "SGPageStyle.h"
#import "Core/SGCore.h"
-static UIFont *sg_titleFont, *sg_subtitleFont;
+static UIFont *sg_spotifyFont;
-UIColor *SGGrey(void) { return [UIColor colorWithWhite:0xB3 / 255.0 alpha:1]; }
-UIFont *SGTitleFont(void) { return sg_titleFont ?: [UIFont systemFontOfSize:13 weight:UIFontWeightBold]; }
-UIFont *SGSubtitleFont(void) { return sg_subtitleFont ?: [UIFont systemFontOfSize:11]; }
+// The dark appearance's secondary label, fixed rather than dynamic so a view that is not set dark reads it too.
+UIColor *SGGrey(void) { return [UIColor colorWithRed:0xEB / 255.0 green:0xEB / 255.0 blue:0xF5 / 255.0 alpha:0.6]; }
+static UIColor *tertiaryGrey(void) { return [UIColor colorWithRed:0xEB / 255.0 green:0xEB / 255.0 blue:0xF5 / 255.0 alpha:0.3]; }
+
+// Settings' text styles at their Large size, made through +systemFontOfSize: so the app font of Shared/Fonts
+// follows, and grown with Dynamic Type no further than xxxLarge: some rows are laid out by hand from these
+// fonts, and the accessibility sizes would outgrow them.
+static UIFont *scaled(UIFontTextStyle style, CGFloat size, CGFloat largest) {
+ return [[UIFontMetrics metricsForTextStyle:style] scaledFontForFont:[UIFont systemFontOfSize:size] maximumPointSize:largest];
+}
+
+UIFont *SGTitleFont(void) { return scaled(UIFontTextStyleBody, 17, 23); }
+UIFont *SGSubtitleFont(void) { return scaled(UIFontTextStyleFootnote, 13, 17); }
+UIFont *SGSpotifyListFont(void) { return sg_spotifyFont ?: [UIFont systemFontOfSize:13 weight:UIFontWeightBold]; }
UIImageView *SGSymbolView(NSString *name, CGFloat size, UIImageSymbolWeight weight, CGFloat box) {
UIImage *image = [UIImage systemImageNamed:name withConfiguration:[UIImageSymbolConfiguration configurationWithPointSize:size weight:weight]];
@@ -67,10 +78,8 @@ void SGInsetForBars(UITableView *table) {
table.verticalScrollIndicatorInsets = inset;
}
-// 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";
+// The pages follow the running look's accent colour, read here by its key so the page framework depends on no
+// layer: the native look's (Native/Appearance) or the redesign's (Redesigned/Kit/SGRAccent.h).
static NSString *const kAccentKey = @"spotifyglass.accent";
static NSString *const kRedesignAccentKey = @"spotifyglass.redesign.accent";
@@ -80,48 +89,63 @@ static UIColor *lookAccent(void) {
return [UIColor colorWithRed:((rgb >> 16) & 0xFF) / 255.0 green:((rgb >> 8) & 0xFF) / 255.0 blue:(rgb & 0xFF) / 255.0 alpha:1];
}
-static BOOL lookBlack(void) {
- return SGRedesignedUI() || SGFlag(kAmoledKey, NO);
-}
-
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 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:(lookBlack() ? 0x1C : 0x2A) / 255.0 alpha:1]; }
+// The dark appearance's system red, and its grouped background and the cards on it, whichever look runs.
+UIColor *SGRed(void) { return [UIColor colorWithRed:0xFF / 255.0 green:0x45 / 255.0 blue:0x3A / 255.0 alpha:1]; }
+UIColor *SGPageBackground(void) { return UIColor.blackColor; }
+UIColor *SGCardBackground(void) { return [UIColor colorWithRed:0x1C / 255.0 green:0x1C / 255.0 blue:0x1E / 255.0 alpha:1]; }
-UIImage *SGTileImage(NSString *symbol) {
- UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:14 weight:UIImageSymbolWeightMedium];
+// 29pt with a 7pt continuous corner and the glyph at 16pt, the size Settings draws its own; a row's title
+// starts 13pt after it, as before the tiles grew, so the pages' own separator insets still line up.
+const CGFloat SGTileRowInset = 16 + 29 + 13;
+
+UIImage *SGTileImageTinted(NSString *symbol, UIColor *color) {
+ UIImageSymbolConfiguration *config = [UIImageSymbolConfiguration configurationWithPointSize:16 weight:UIImageSymbolWeightMedium];
UIImage *glyph = [[UIImage systemImageNamed:symbol withConfiguration:config] imageWithTintColor:UIColor.whiteColor renderingMode:UIImageRenderingModeAlwaysOriginal];
- CGRect box = CGRectMake(0, 0, 28, 28);
+ CGRect box = CGRectMake(0, 0, 29, 29);
+ // A system colour is drawn in its dark appearance, the one the pages wear, whatever the phone's.
+ color = [color resolvedColorWithTraitCollection:[UITraitCollection traitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark]];
UIImage *tile = [[[UIGraphicsImageRenderer alloc] initWithSize:box.size] imageWithActions:^(UIGraphicsImageRendererContext *ctx) {
- [[UIColor colorWithWhite:1 alpha:0.12] setFill];
+ [color setFill];
[[UIBezierPath bezierPathWithRoundedRect:box cornerRadius:7] fill];
+ // A wide glyph is fitted inside the square's padding rather than over its edge.
CGSize size = glyph.size;
+ CGFloat fit = MIN(1, MIN(21 / size.width, 21 / size.height));
+ size = CGSizeMake(size.width * fit, size.height * fit);
[glyph drawInRect:CGRectMake((box.size.width - size.width) / 2, (box.size.height - size.height) / 2, size.width, size.height)];
}];
return [tile imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
}
+UIImage *SGTileImage(NSString *symbol) {
+ return SGTileImageTinted(symbol, [UIColor colorWithRed:0x8E / 255.0 green:0x8E / 255.0 blue:0x93 / 255.0 alpha:1]);
+}
+
+UIImageView *SGChevronView(void) {
+ UIImageView *chevron = SGSymbolView(@"chevron.right", 13, UIImageSymbolWeightSemibold, 16);
+ chevron.tintColor = tertiaryGrey();
+ return chevron;
+}
+
const CGFloat SGSectionHeaderHeight = 38;
const CGFloat SGSectionGap = 20;
-// Every page below draws Spotify's own list row: a 13pt white title over an 11pt grey subtitle,
-// with an optional symbol in the leading slot.
+// Every page below draws Settings' own row: a 17pt white title over a 15pt grey subtitle, with an optional
+// symbol in the leading slot, 44pt high with no subtitle.
void SGFillCell(UITableViewCell *cell, NSString *title, NSString *subtitle, UIColor *color, NSString *symbolName) {
UIListContentConfiguration *content = [UIListContentConfiguration subtitleCellConfiguration];
content.text = title;
content.secondaryText = subtitle;
content.textProperties.font = SGTitleFont();
content.textProperties.color = color ?: UIColor.whiteColor;
- content.secondaryTextProperties.font = SGSubtitleFont();
+ content.secondaryTextProperties.font = scaled(UIFontTextStyleSubheadline, 15, 21);
content.secondaryTextProperties.color = SGGrey();
- content.textToSecondaryTextVerticalPadding = 0;
- content.directionalLayoutMargins = NSDirectionalEdgeInsetsMake(10, 16, 10, 16);
+ content.textToSecondaryTextVerticalPadding = 2;
+ content.directionalLayoutMargins = NSDirectionalEdgeInsetsMake(11, 16, 11, 16);
if (symbolName) {
- content.image = [UIImage systemImageNamed:symbolName withConfiguration:[UIImageSymbolConfiguration configurationWithPointSize:15 weight:UIImageSymbolWeightRegular]];
+ content.image = [UIImage systemImageNamed:symbolName withConfiguration:[UIImageSymbolConfiguration configurationWithPointSize:17 weight:UIImageSymbolWeightRegular]];
content.imageProperties.tintColor = color ?: UIColor.whiteColor;
- content.imageToTextPadding = 14;
+ content.imageToTextPadding = 13;
}
cell.contentConfiguration = content;
cell.backgroundColor = SGCardBackground();
@@ -134,7 +158,9 @@ UIView *SGSectionHeader(UITableView *table, NSString *title) {
label.text = title.uppercaseString;
label.font = SGSubtitleFont();
label.textColor = SGGrey();
- label.frame = CGRectMake(16, 20, table.bounds.size.width - 32, 14);
+ // On the header's foot, 7pt over the card, however tall Dynamic Type makes the line.
+ CGFloat height = ceil(label.font.lineHeight);
+ label.frame = CGRectMake(16, SGSectionHeaderHeight - 7 - height, table.bounds.size.width - 32, height);
label.autoresizingMask = UIViewAutoresizingFlexibleWidth;
UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, table.bounds.size.width, SGSectionHeaderHeight)];
[header addSubview:label];
@@ -175,22 +201,13 @@ UITableViewCell *SGDequeueCell(UITableView *table, NSString *identifier) {
?: [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
}
-static CGFloat brightness(UIColor *color) {
- CGFloat white = 0;
- [color getWhite:&white alpha:NULL];
- return white;
-}
-
-// Spotify's list labels carry its typeface: 13pt titles and 11pt grey subtitles.
+// Spotify's list titles carry its typeface at 13pt.
void SGAdoptFonts(UIView *list, UIView *row) {
- if (sg_titleFont && sg_subtitleFont) return;
+ if (sg_spotifyFont) return;
SGForEachView(list, ^(UIView *v) {
- if (![v isKindOfClass:UILabel.class] || SGIsInside(v, row)) return;
+ if (sg_spotifyFont || ![v isKindOfClass:UILabel.class] || SGIsInside(v, row)) return;
UILabel *label = (UILabel *)v;
- if (label.text.length < 2) return;
- CGFloat size = label.font.pointSize, white = brightness(label.textColor);
- if (size == 13 && !sg_titleFont) sg_titleFont = label.font;
- if (size == 11 && !sg_subtitleFont && white > 0.3 && white < 0.95) sg_subtitleFont = label.font;
+ if (label.text.length >= 2 && label.font.pointSize == 13) sg_spotifyFont = label.font;
});
}
diff --git a/tweak/Sources/Shared/AudioEffects/AudioEffectsPage.m b/tweak/Sources/Shared/AudioEffects/AudioEffectsPage.m
index 0dece5e6..226e8497 100644
--- a/tweak/Sources/Shared/AudioEffects/AudioEffectsPage.m
+++ b/tweak/Sources/Shared/AudioEffects/AudioEffectsPage.m
@@ -283,9 +283,10 @@ static UIFont *tabular(UIFont *font) {
CGFloat width = self.contentView.bounds.size.width, side = 16;
[_value sizeToFit];
CGFloat valueWidth = MAX(_value.bounds.size.width, 44);
- _value.frame = CGRectMake(width - side - valueWidth, 12, valueWidth, 18);
- _title.frame = CGRectMake(side, 12, CGRectGetMinX(_value.frame) - side - 8, 18);
- _slider.frame = CGRectMake(side, 36, width - 2 * side, 28);
+ CGFloat line = ceil(_title.font.lineHeight); // as tall as Dynamic Type makes the title
+ _value.frame = CGRectMake(width - side - valueWidth, 12, valueWidth, line);
+ _title.frame = CGRectMake(side, 12, CGRectGetMinX(_value.frame) - side - 8, line);
+ _slider.frame = CGRectMake(side, 12 + line + 6, width - 2 * side, 28);
}
- (void)moved {
@@ -391,7 +392,7 @@ static UIView *valueAndChevron(NSString *text) {
label.textColor = SGGrey();
label.text = text;
[label sizeToFit];
- UIImageView *chevron = SGSymbolView(@"chevron.right", 13, UIImageSymbolWeightSemibold, 16);
+ UIImageView *chevron = SGChevronView();
CGFloat height = MAX(label.bounds.size.height, chevron.bounds.size.height);
UIView *box = [[UIView alloc] initWithFrame:CGRectMake(0, 0, label.bounds.size.width + 6 + chevron.bounds.size.width, height)];
label.center = CGPointMake(label.bounds.size.width / 2, height / 2);
@@ -552,7 +553,7 @@ static UIView *valueAndChevron(NSString *text) {
// The heads, the values and the errors size themselves; a nil row would read as a slider.
SGDSPRow *row = [self rowAt:path];
if (!row) return UITableViewAutomaticDimension;
- if (row.kind == SGDSPRowSlider) return 74;
+ if (row.kind == SGDSPRowSlider) return 12 + ceil(SGTitleFont().lineHeight) + 6 + 28 + 10;
if (row.kind == SGDSPRowCurve) return [SGDSPCurveView heightForKey:row.key];
return UITableViewAutomaticDimension;
}
@@ -643,7 +644,7 @@ static UIView *valueAndChevron(NSString *text) {
CGFloat titleWidth = ceil([title sizeWithAttributes:@{NSFontAttributeName: SGTitleFont()}].width);
BOOL fits = 16 + titleWidth + 16 + accessory.bounds.size.width + 16 <= card;
SGFillCell(cell, title, fits ? nil : value, nil, nil);
- cell.accessoryView = fits ? accessory : SGSymbolView(@"chevron.right", 13, UIImageSymbolWeightSemibold, 16);
+ cell.accessoryView = fits ? accessory : SGChevronView();
cell.accessibilityValue = value;
cell.selectionStyle = UITableViewCellSelectionStyleDefault;
cell.separatorInset = UIEdgeInsetsMake(0, 16, 0, 0);