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): count CSS named slop colors in slop-gradient (#167)

susheelg1197074d91fcddbb
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index 42e87e2..cc2c6ba 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -129,7 +129,9 @@ function isSaturated(hex) {
return s >= 0.35 && l >= 0.15 && l <= 0.9;
}
-const SLOP_COLOR_NAME = /(?:\.|Colors\.|Color\.|\b)(purple|deepPurple|indigo|violet|pink|magenta|fuchsia)\b/i;
+// 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;
// 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 8a474e0..8e1e6b9 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -566,6 +566,14 @@ test("slop-gradient reads Tailwind arbitrary hex stops (issue #143)", () => {
assert.deepStrictEqual(lines('<div class="bg-[#7c3aed] text-white">Hello</div>\n', "Hero.html"), []);
});
+test("slop-gradient reads CSS named colors in the slop band (issue #163)", () => {
+ const rulesFor = (src) => scanSource(src, "a.css").map((f) => f.rule).filter((r) => r === "slop-gradient");
+ for (const name of ["rebeccapurple", "mediumpurple", "blueviolet", "darkviolet", "darkorchid", "mediumorchid", "hotpink", "deeppink", "mediumvioletred", "RebeccaPurple"]) {
+ assert.deepStrictEqual(rulesFor(`.a { background: linear-gradient(${name}, white); }\n`), ["slop-gradient"], name);
+ }
+ assert.deepStrictEqual(rulesFor(".a { background: linear-gradient(skyblue, seagreen); }\n"), []);
+});
+
test("slop-gradient reads only the gradient's own colors (issue #67)", () => {
const gradientLines = (src, file) =>
scanSource(src, file).filter((f) => f.rule === "slop-gradient").map((f) => f.line);