Choose colors for websites, slides, brand materials, or app UI: build a palette from a base color using harmony rules, assign usage roles, and verify WCAG contrast ratios. Triggers on: pick a color palette, brand colors, what colors go together, accessible color combinations, text contrast check, analogous vs complementary colors.
./install.sh color-theory-basicsname: "color_theory_basics" description: "Choose colors for websites, slides, brand materials, or app UI: build a palette from a base color using harmony rules, assign usage roles, and verify WCAG contrast ratios. Triggers on: pick a color palette, brand colors, what colors go together, accessible color combinations, text contrast check, analogous vs complementary colors." metadata: { "includeInPrompt": true }
Pick colors that work together for any visual deliverable: site, deck, brand kit, app UI. Covers the color wheel, harmony rules, palette building, and contrast checks. It does not cover video color grading (LUTs, vectorscopes, shot matching); the catalog's separate color-grading skill owns that.
Save as contrast_check.py and run with python3 contrast_check.py <fg-hex> <bg-hex>, e.g. python3 contrast_check.py "#1a1a1a" "#ffffff". Verified working on python3 with standard library only.
python
import sys
def lin(c):
c = c / 255.0
return c / 12.92 if c <= 0.03928 else ((c + 0.055) / 1.055) ** 2.4
def luminance(hex):
hex = hex.strip().lstrip('#')
r, g, b = int(hex[0:2], 16), int(hex[2:4], 16), int(hex[4:6], 16)
return 0.2126 * lin(r) + 0.7152 * lin(g) + 0.0722 * lin(b)
def ratio(h1, h2):
l1, l2 = luminance(h1), luminance(h2)
hi, lo = max(l1, l2), min(l1, l2)
return (hi + 0.05) / (lo + 0.05)
if __name__ == '__main__':
fg, bg = sys.argv[1], sys.argv[2]
r = ratio(fg, bg)
def verdict(t):
return 'PASS' if r >= t else 'FAIL'
print(f"{fg} on {bg}: {r:.2f}:1")
print(f" normal text (>=4.5): {verdict(4.5)}")
print(f" large text (>=3.0): {verdict(3.0)}")
Deliver: the palette as named colors with hex values, each color's role (background, text, button, accent, status), and a contrast table showing each text/background pair's ratio and PASS/FAIL against the 4.5:1 and 3:1 floors. Include the harmony rule you used and one sentence on why it fits the brief. If a pair fails, say which color to darken or lighten and by how much (a rough hex adjustment is fine).
publisher key 2e43c913833850e6d80f939677e3de76e806d47785c0f1caaca90f9d18c98e1e
No ratings yet — be the first to rate it.