Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Generate complete design systems with styles, colors, fonts, and UX rules for web and mobile apps
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
data/_sync_all.py
1#!/usr/bin/env python32"""3Sync colors.csv and ui-reasoning.csv with the updated products.csv (161 entries).4- Remove deleted product types5- Rename mismatched entries6- Add new entries for missing product types7- Keep colors.csv aligned 1:1 with products.csv8- Renumber everything9"""10import csv, os, json1112BASE = os.path.dirname(os.path.abspath(__file__))1314# ─── Color derivation helpers ────────────────────────────────────────────────15def h2r(h):16h = h.lstrip("#")17return tuple(int(h[i:i+2], 16) for i in (0, 2, 4))1819def r2h(r, g, b):20return f"#{max(0,min(255,int(r))):02X}{max(0,min(255,int(g))):02X}{max(0,min(255,int(b))):02X}"2122def lum(h):23r, g, b = [x/255.0 for x in h2r(h)]24r, g, b = [(x/12.92 if x<=0.03928 else ((x+0.055)/1.055)**2.4) for x in (r, g, b)]25return 0.2126*r + 0.7152*g + 0.0722*b2627def is_dark(bg):28return lum(bg) < 0.182930def on_color(bg):31return "#FFFFFF" if lum(bg) < 0.4 else "#0F172A"3233def blend(a, b, f=0.15):34ra, ga, ba = h2r(a)35rb, gb, bb = h2r(b)36return r2h(ra+(rb-ra)*f, ga+(gb-ga)*f, ba+(bb-ba)*f)3738def shift(h, n):39r, g, b = h2r(h)40return r2h(r+n, g+n, b+n)4142def derive_row(pt, pri, sec, acc, bg, notes=""):43"""Generate full 16-token color row from 4 base colors."""44dark = is_dark(bg)45fg = "#FFFFFF" if dark else "#0F172A"46on_pri = on_color(pri)47on_sec = on_color(sec)48on_acc = on_color(acc)49card = shift(bg, 10) if dark else "#FFFFFF"50card_fg = "#FFFFFF" if dark else "#0F172A"51muted = blend(bg, pri, 0.08) if dark else blend("#FFFFFF", pri, 0.06)52muted_fg = "#94A3B8" if dark else "#64748B"53border = f"rgba(255,255,255,0.08)" if dark else blend("#FFFFFF", pri, 0.12)54destr = "#DC2626"55on_destr = "#FFFFFF"56ring = pri57return [pt, pri, on_pri, sec, on_sec, acc, on_acc, bg, fg, card, card_fg, muted, muted_fg, border, destr, on_destr, ring, notes]5859# ─── Rename maps ─────────────────────────────────────────────────────────────60COLOR_RENAMES = {61"Quantum Computing": "Quantum Computing Interface",62"Biohacking / Longevity": "Biohacking / Longevity App",63"Autonomous Systems": "Autonomous Drone Fleet Manager",64"Generative AI Art": "Generative Art Platform",65"Spatial / Vision OS": "Spatial Computing OS / App",66"Climate Tech": "Sustainable Energy / Climate Tech",67}68UI_RENAMES = {69"Architecture/Interior": "Architecture / Interior",70"Autonomous Drone Fleet": "Autonomous Drone Fleet Manager",71"B2B SaaS Enterprise": "B2B Service",72"Biohacking/Longevity App": "Biohacking / Longevity App",73"Biotech/Life Sciences": "Biotech / Life Sciences",74"Developer Tool/IDE": "Developer Tool / IDE",75"Education": "Educational App",76"Fintech (Banking)": "Fintech/Crypto",77"Government/Public": "Government/Public Service",78"Home Services": "Home Services (Plumber/Electrician)",79"Micro-Credentials/Badges": "Micro-Credentials/Badges Platform",80"Music/Entertainment": "Music Streaming",81"Quantum Computing": "Quantum Computing Interface",82"Real Estate": "Real Estate/Property",83"Remote Work/Collaboration": "Remote Work/Collaboration Tool",84"Restaurant/Food": "Restaurant/Food Service",85"SaaS Dashboard": "Analytics Dashboard",86"Space Tech/Aerospace": "Space Tech / Aerospace",87"Spatial Computing OS": "Spatial Computing OS / App",88"Startup Landing": "Micro SaaS",89"Sustainable Energy/Climate": "Sustainable Energy / Climate Tech",90"Travel/Tourism": "Travel/Tourism Agency",91"Wellness/Mental Health": "Mental Health App",92}9394REMOVE_TYPES = {95"Service Landing Page", "Sustainability/ESG Platform",96"Cleaning Service", "Coffee Shop",97"Consulting Firm", "Conference/Webinar Platform",98}99100# ─── New color definitions: (primary, secondary, accent, bg, notes) ──────────101# Grouped by category for clarity. Each tuple generates a full 16-token row.102NEW_COLORS = {103# ── Old #97-#116 that never got colors ──104"Todo & Task Manager": ("#2563EB","#3B82F6","#059669","#F8FAFC","Functional blue + progress green"),105"Personal Finance Tracker": ("#1E40AF","#3B82F6","#059669","#0F172A","Trust blue + profit green on dark"),106"Chat & Messaging App": ("#2563EB","#6366F1","#059669","#FFFFFF","Messenger blue + online green"),107"Notes & Writing App": ("#78716C","#A8A29E","#D97706","#FFFBEB","Warm ink + amber accent on cream"),108"Habit Tracker": ("#D97706","#F59E0B","#059669","#FFFBEB","Streak amber + habit green"),109"Food Delivery / On-Demand": ("#EA580C","#F97316","#2563EB","#FFF7ED","Appetizing orange + trust blue"),110"Ride Hailing / Transportation":("#1E293B","#334155","#2563EB","#0F172A","Map dark + route blue"),111"Recipe & Cooking App": ("#9A3412","#C2410C","#059669","#FFFBEB","Warm terracotta + fresh green"),112"Meditation & Mindfulness": ("#7C3AED","#8B5CF6","#059669","#FAF5FF","Calm lavender + mindful green"),113"Weather App": ("#0284C7","#0EA5E9","#F59E0B","#F0F9FF","Sky blue + sun amber"),114"Diary & Journal App": ("#92400E","#A16207","#6366F1","#FFFBEB","Warm journal brown + ink violet"),115"CRM & Client Management": ("#2563EB","#3B82F6","#059669","#F8FAFC","Professional blue + deal green"),116"Inventory & Stock Management":("#334155","#475569","#059669","#F8FAFC","Industrial slate + stock green"),117"Flashcard & Study Tool": ("#7C3AED","#8B5CF6","#059669","#FAF5FF","Study purple + correct green"),118"Booking & Appointment App": ("#0284C7","#0EA5E9","#059669","#F0F9FF","Calendar blue + available green"),119"Invoice & Billing Tool": ("#1E3A5F","#2563EB","#059669","#F8FAFC","Navy professional + paid green"),120"Grocery & Shopping List": ("#059669","#10B981","#D97706","#ECFDF5","Fresh green + food amber"),121"Timer & Pomodoro": ("#DC2626","#EF4444","#059669","#0F172A","Focus red on dark + break green"),122"Parenting & Baby Tracker": ("#EC4899","#F472B6","#0284C7","#FDF2F8","Soft pink + trust blue"),123"Scanner & Document Manager": ("#1E293B","#334155","#2563EB","#F8FAFC","Document grey + scan blue"),124# ── A. Utility / Productivity ──125"Calendar & Scheduling App": ("#2563EB","#3B82F6","#059669","#F8FAFC","Calendar blue + event green"),126"Password Manager": ("#1E3A5F","#334155","#059669","#0F172A","Vault dark blue + secure green"),127"Expense Splitter / Bill Split":("#059669","#10B981","#DC2626","#F8FAFC","Balance green + owe red"),128"Voice Recorder & Memo": ("#DC2626","#EF4444","#2563EB","#FFFFFF","Recording red + waveform blue"),129"Bookmark & Read-Later": ("#D97706","#F59E0B","#2563EB","#FFFBEB","Warm amber + link blue"),130"Translator App": ("#2563EB","#0891B2","#EA580C","#F8FAFC","Global blue + teal + accent orange"),131"Calculator & Unit Converter": ("#EA580C","#F97316","#2563EB","#1C1917","Operation orange on dark"),132"Alarm & World Clock": ("#D97706","#F59E0B","#6366F1","#0F172A","Time amber + night indigo on dark"),133"File Manager & Transfer": ("#2563EB","#3B82F6","#D97706","#F8FAFC","Folder blue + file amber"),134"Email Client": ("#2563EB","#3B82F6","#DC2626","#FFFFFF","Inbox blue + priority red"),135# ── B. Games ──136"Casual Puzzle Game": ("#EC4899","#8B5CF6","#F59E0B","#FDF2F8","Cheerful pink + reward gold"),137"Trivia & Quiz Game": ("#2563EB","#7C3AED","#F59E0B","#EFF6FF","Quiz blue + gold leaderboard"),138"Card & Board Game": ("#15803D","#166534","#D97706","#0F172A","Felt green + gold on dark"),139"Idle & Clicker Game": ("#D97706","#F59E0B","#7C3AED","#FFFBEB","Coin gold + prestige purple"),140"Word & Crossword Game": ("#15803D","#059669","#D97706","#FFFFFF","Word green + letter amber"),141"Arcade & Retro Game": ("#DC2626","#2563EB","#22C55E","#0F172A","Neon red+blue on dark + score green"),142# ── C. Creator Tools ──143"Photo Editor & Filters": ("#7C3AED","#6366F1","#0891B2","#0F172A","Editor violet + filter cyan on dark"),144"Short Video Editor": ("#EC4899","#DB2777","#2563EB","#0F172A","Video pink on dark + timeline blue"),145"Drawing & Sketching Canvas": ("#7C3AED","#8B5CF6","#0891B2","#1C1917","Canvas purple + tool teal on dark"),146"Music Creation & Beat Maker": ("#7C3AED","#6366F1","#22C55E","#0F172A","Studio purple + waveform green on dark"),147"Meme & Sticker Maker": ("#EC4899","#F59E0B","#2563EB","#FFFFFF","Viral pink + comedy yellow + share blue"),148"AI Photo & Avatar Generator": ("#7C3AED","#6366F1","#EC4899","#FAF5FF","AI purple + generation pink"),149"Link-in-Bio Page Builder": ("#2563EB","#7C3AED","#EC4899","#FFFFFF","Brand blue + creator purple"),150# ── D. Personal Life ──151"Wardrobe & Outfit Planner": ("#BE185D","#EC4899","#D97706","#FDF2F8","Fashion rose + gold accent"),152"Plant Care Tracker": ("#15803D","#059669","#D97706","#F0FDF4","Nature green + sun yellow"),153"Book & Reading Tracker": ("#78716C","#92400E","#D97706","#FFFBEB","Book brown + page amber"),154"Couple & Relationship App": ("#BE185D","#EC4899","#DC2626","#FDF2F8","Romance rose + love red"),155"Family Calendar & Chores": ("#2563EB","#059669","#D97706","#F8FAFC","Family blue + chore green"),156"Mood Tracker": ("#7C3AED","#6366F1","#D97706","#FAF5FF","Mood purple + insight amber"),157"Gift & Wishlist": ("#DC2626","#D97706","#EC4899","#FFF1F2","Gift red + gold + surprise pink"),158# ── E. Health ──159"Running & Cycling GPS": ("#EA580C","#F97316","#059669","#0F172A","Energetic orange + pace green on dark"),160"Yoga & Stretching Guide": ("#6B7280","#78716C","#0891B2","#F5F5F0","Sage neutral + calm teal"),161"Sleep Tracker": ("#4338CA","#6366F1","#7C3AED","#0F172A","Night indigo + dream violet on dark"),162"Calorie & Nutrition Counter": ("#059669","#10B981","#EA580C","#ECFDF5","Healthy green + macro orange"),163"Period & Cycle Tracker": ("#BE185D","#EC4899","#7C3AED","#FDF2F8","Blush rose + fertility lavender"),164"Medication & Pill Reminder": ("#0284C7","#0891B2","#DC2626","#F0F9FF","Medical blue + alert red"),165"Water & Hydration Reminder": ("#0284C7","#06B6D4","#0891B2","#F0F9FF","Refreshing blue + water cyan"),166"Fasting & Intermittent Timer":("#6366F1","#4338CA","#059669","#0F172A","Fasting indigo on dark + eating green"),167# ── F. Social ──168"Anonymous Community / Confession":("#475569","#334155","#0891B2","#0F172A","Protective grey + subtle teal on dark"),169"Local Events & Discovery": ("#EA580C","#F97316","#2563EB","#FFF7ED","Event orange + map blue"),170"Study Together / Virtual Coworking":("#2563EB","#3B82F6","#059669","#F8FAFC","Focus blue + session green"),171# ── G. Education ──172"Coding Challenge & Practice": ("#22C55E","#059669","#D97706","#0F172A","Code green + difficulty amber on dark"),173"Kids Learning (ABC & Math)": ("#2563EB","#F59E0B","#EC4899","#EFF6FF","Learning blue + play yellow + fun pink"),174"Music Instrument Learning": ("#DC2626","#9A3412","#D97706","#FFFBEB","Musical red + warm amber"),175# ── H. Transport ──176"Parking Finder": ("#2563EB","#059669","#DC2626","#F0F9FF","Available blue/green + occupied red"),177"Public Transit Guide": ("#2563EB","#0891B2","#EA580C","#F8FAFC","Transit blue + line colors"),178"Road Trip Planner": ("#EA580C","#0891B2","#D97706","#FFF7ED","Adventure orange + map teal"),179# ── I. Safety & Lifestyle ──180"VPN & Privacy Tool": ("#1E3A5F","#334155","#22C55E","#0F172A","Shield dark + connected green"),181"Emergency SOS & Safety": ("#DC2626","#EF4444","#2563EB","#FFF1F2","Alert red + safety blue"),182"Wallpaper & Theme App": ("#7C3AED","#EC4899","#2563EB","#FAF5FF","Aesthetic purple + trending pink"),183"White Noise & Ambient Sound": ("#475569","#334155","#4338CA","#0F172A","Ambient grey + deep indigo on dark"),184"Home Decoration & Interior Design":("#78716C","#A8A29E","#D97706","#FAF5F2","Interior warm grey + gold accent"),185}186187# ─── 1. REBUILD colors.csv ───────────────────────────────────────────────────188def rebuild_colors():189src = os.path.join(BASE, "colors.csv")190with open(src, newline="", encoding="utf-8") as f:191reader = csv.DictReader(f)192headers = reader.fieldnames193existing = list(reader)194195# Build lookup: Product Type -> row data196color_map = {}197for row in existing:198pt = row.get("Product Type", "").strip()199if not pt:200continue201# Remove deleted types202if pt in REMOVE_TYPES:203print(f" [colors] REMOVE: {pt}")204continue205# Rename mismatched types206if pt in COLOR_RENAMES:207new_name = COLOR_RENAMES[pt]208print(f" [colors] RENAME: {pt} → {new_name}")209row["Product Type"] = new_name210pt = new_name211color_map[pt] = row212213# Read products.csv to get the correct order214with open(os.path.join(BASE, "products.csv"), newline="", encoding="utf-8") as f:215products = list(csv.DictReader(f))216217# Build final rows in products.csv order218final_rows = []219added = 0220for i, prod in enumerate(products, 1):221pt = prod["Product Type"]222if pt in color_map:223row = color_map[pt]224row["No"] = str(i)225final_rows.append(row)226elif pt in NEW_COLORS:227pri, sec, acc, bg, notes = NEW_COLORS[pt]228new_row = derive_row(pt, pri, sec, acc, bg, notes)229d = dict(zip(headers, [str(i)] + new_row))230final_rows.append(d)231added += 1232else:233print(f" [colors] WARNING: No color data for '{pt}' - using defaults")234new_row = derive_row(pt, "#2563EB", "#3B82F6", "#059669", "#F8FAFC", "Auto-generated default")235d = dict(zip(headers, [str(i)] + new_row))236final_rows.append(d)237added += 1238239# Write240with open(src, "w", newline="", encoding="utf-8") as f:241writer = csv.DictWriter(f, fieldnames=headers)242writer.writeheader()243writer.writerows(final_rows)244245product_count = len(products)246print(f"\n ✅ colors.csv: {len(final_rows)} rows ({product_count} products)")247print(f" Added: {added} new color rows")248249# ─── 2. REBUILD ui-reasoning.csv ─────────────────────────────────────────────250def derive_ui_reasoning(prod):251"""Generate ui-reasoning row from products.csv row."""252pt = prod["Product Type"]253style = prod.get("Primary Style Recommendation", "")254landing = prod.get("Landing Page Pattern", "")255color_focus = prod.get("Color Palette Focus", "")256considerations = prod.get("Key Considerations", "")257keywords = prod.get("Keywords", "")258259# Typography mood derived from style260typo_map = {261"Minimalism": "Professional + Clean hierarchy",262"Glassmorphism": "Modern + Clear hierarchy",263"Brutalism": "Bold + Oversized + Monospace",264"Claymorphism": "Playful + Rounded + Friendly",265"Dark Mode": "High contrast + Light on dark",266"Neumorphism": "Subtle + Soft + Monochromatic",267"Flat Design": "Bold + Clean + Sans-serif",268"Vibrant": "Energetic + Bold + Large",269"Aurora": "Elegant + Gradient-friendly",270"AI-Native": "Conversational + Minimal chrome",271"Organic": "Warm + Humanist + Natural",272"Motion": "Dynamic + Hierarchy-shifting",273"Accessible": "Large + High contrast + Clear",274"Soft UI": "Modern + Accessible + Balanced",275"Trust": "Professional + Serif accents",276"Swiss": "Grid-based + Mathematical + Helvetica",277"3D": "Immersive + Spatial + Variable",278"Retro": "Nostalgic + Monospace + Neon",279"Cyberpunk": "Terminal + Monospace + Neon",280"Pixel": "Retro + Blocky + 8-bit",281}282typo_mood = "Professional + Clear hierarchy"283for key, val in typo_map.items():284if key.lower() in style.lower():285typo_mood = val286break287288# Key effects from style289eff_map = {290"Glassmorphism": "Backdrop blur (10-20px) + Translucent overlays",291"Neumorphism": "Dual shadows (light+dark) + Soft press 150ms",292"Claymorphism": "Multi-layer shadows + Spring bounce + Soft press 200ms",293"Brutalism": "No transitions + Hard borders + Instant feedback",294"Dark Mode": "Subtle glow + Neon accents + High contrast",295"Flat Design": "Color shift hover + Fast 150ms transitions + No shadows",296"Minimalism": "Subtle hover 200ms + Smooth transitions + Clean",297"Motion-Driven": "Scroll animations + Parallax + Page transitions",298"Micro-interactions": "Haptic feedback + Small 50-100ms animations",299"Vibrant": "Large section gaps 48px+ + Color shift hover + Scroll-snap",300"Aurora": "Flowing gradients 8-12s + Color morphing",301"AI-Native": "Typing indicator + Streaming text + Context reveal",302"Organic": "Rounded 16-24px + Natural shadows + Flowing SVG",303"Soft UI": "Improved shadows + Modern 200-300ms + Focus visible",304"3D": "WebGL/Three.js + Parallax 3-5 layers + Physics 300-400ms",305"Trust": "Clear focus rings + Badge hover + Metric pulse",306"Accessible": "Focus rings 3-4px + ARIA + Reduced motion",307}308key_effects = "Subtle hover (200ms) + Smooth transitions"309for key, val in eff_map.items():310if key.lower() in style.lower():311key_effects = val312break313314# Decision rules315rules = {}316if "dark" in style.lower() or "oled" in style.lower():317rules["if_light_mode_needed"] = "provide-theme-toggle"318if "glass" in style.lower():319rules["if_low_performance"] = "fallback-to-flat"320if "conversion" in landing.lower():321rules["if_conversion_focused"] = "add-urgency-colors"322if "social" in landing.lower():323rules["if_trust_needed"] = "add-testimonials"324if "data" in keywords.lower() or "dashboard" in keywords.lower():325rules["if_data_heavy"] = "prioritize-data-density"326if not rules:327rules["if_ux_focused"] = "prioritize-clarity"328rules["if_mobile"] = "optimize-touch-targets"329330# Anti-patterns331anti_patterns = []332if "minimalism" in style.lower() or "minimal" in style.lower():333anti_patterns.append("Excessive decoration")334if "dark" in style.lower():335anti_patterns.append("Pure white backgrounds")336if "flat" in style.lower():337anti_patterns.append("Complex shadows + 3D effects")338if "vibrant" in style.lower():339anti_patterns.append("Muted colors + Low energy")340if "accessible" in style.lower():341anti_patterns.append("Color-only indicators")342if not anti_patterns:343anti_patterns = ["Inconsistent styling", "Poor contrast ratios"]344anti_str = " + ".join(anti_patterns[:2])345346return {347"UI_Category": pt,348"Recommended_Pattern": landing,349"Style_Priority": style,350"Color_Mood": color_focus,351"Typography_Mood": typo_mood,352"Key_Effects": key_effects,353"Decision_Rules": json.dumps(rules),354"Anti_Patterns": anti_str,355"Severity": "HIGH"356}357358359def rebuild_ui_reasoning():360src = os.path.join(BASE, "ui-reasoning.csv")361with open(src, newline="", encoding="utf-8") as f:362reader = csv.DictReader(f)363headers = reader.fieldnames364existing = list(reader)365366# Build lookup367ui_map = {}368for row in existing:369cat = row.get("UI_Category", "").strip()370if not cat:371continue372if cat in REMOVE_TYPES:373print(f" [ui-reason] REMOVE: {cat}")374continue375if cat in UI_RENAMES:376new_name = UI_RENAMES[cat]377print(f" [ui-reason] RENAME: {cat} → {new_name}")378row["UI_Category"] = new_name379cat = new_name380ui_map[cat] = row381382with open(os.path.join(BASE, "products.csv"), newline="", encoding="utf-8") as f:383products = list(csv.DictReader(f))384385final_rows = []386added = 0387for i, prod in enumerate(products, 1):388pt = prod["Product Type"]389if pt in ui_map:390row = ui_map[pt]391row["No"] = str(i)392final_rows.append(row)393else:394row = derive_ui_reasoning(prod)395row["No"] = str(i)396final_rows.append(row)397added += 1398399with open(src, "w", newline="", encoding="utf-8") as f:400writer = csv.DictWriter(f, fieldnames=headers)401writer.writeheader()402writer.writerows(final_rows)403404print(f"\n ✅ ui-reasoning.csv: {len(final_rows)} rows")405print(f" Added: {added} new reasoning rows")406407408# ─── MAIN ────────────────────────────────────────────────────────────────────409if __name__ == "__main__":410print("=== Rebuilding colors.csv ===")411rebuild_colors()412print("\n=== Rebuilding ui-reasoning.csv ===")413rebuild_ui_reasoning()414print("\n🎉 Done!")415