Skip to content

Your app looks AI-generated. Vincent Van Gogh noticed. An agent skill that finds and fixes AI-looking UI and UX in mobile apps, web apps, and websites.

fix(detect): flag UIKit system colors in slop-gradient (#177) (#189)

Papito084329cedfcc688
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index 6b01735..38fc283 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -183,8 +183,8 @@ function isSaturated(hex) {
}
// Also the CSS named colors in that band (rebeccapurple, hotpink, ...), which a
-// plain \bpurple\b or \bpink\b does not reach.
-const SLOP_COLOR_NAME = /(?:\.|Colors\.|Color\.|\b)(purple|deepPurple|indigo|violet|pink|magenta|fuchsia|rebeccapurple|mediumpurple|blueviolet|darkviolet|darkorchid|mediumorchid|hotpink|deeppink|mediumvioletred)\b/i;
+// plain \bpurple\b or \bpink\b does not reach, and UIKit system colors (.systemPurple, ...).
+const SLOP_COLOR_NAME = /(?:\.|Colors\.|Color\.|\b)(?:system)?(purple|deepPurple|indigo|violet|pink|magenta|fuchsia|rebeccapurple|mediumpurple|blueviolet|darkviolet|darkorchid|mediumorchid|hotpink|deeppink|mediumvioletred)\b/i;
// Replace comments with spaces, keeping offsets and newlines, so rules never
// match commented-out code. Strings are kept.
diff --git a/test/detect.test.js b/test/detect.test.js
index df2f1ba..f88fd3d 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -1800,3 +1800,23 @@ test("glow-shadow checks each box-shadow layer independently so a neutral layer
];
for (const [src, file] of quiet) assert.deepStrictEqual(rulesFor(src, file), [], src);
});
+
+test("slop-gradient reads UIKit system colors like .systemPurple and .systemPink", () => {
+ const rulesFor = (src) => scanSource(src, "Hero.swift").map((f) => f.rule).filter((r) => r === "slop-gradient");
+ const gradient = (stops) => `LinearGradient(colors: [${stops}], startPoint: .leading, endPoint: .trailing)\n`;
+ const flagged = [
+ "Color(.systemPurple), Color(.systemPink)",
+ "Color(uiColor: .systemIndigo), Color(uiColor: .systemPink)",
+ "UIColor.systemPurple, UIColor.systemPink",
+ ".systemPurple, .systemPink",
+ ".systemIndigo, .white",
+ ];
+ for (const stops of flagged) assert.deepStrictEqual(rulesFor(gradient(stops)), ["slop-gradient"], stops);
+
+ const quiet = [
+ "Color(.systemTeal), Color(.systemBlue)",
+ "Color(uiColor: .systemTeal), Color(uiColor: .systemBlue)",
+ "UIColor.systemGreen, UIColor.systemBlue",
+ ];
+ for (const stops of quiet) assert.deepStrictEqual(rulesFor(gradient(stops)), [], stops);
+});