Skip to content
Darshan3690Public

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

UISnap Logo

🎯 UISnap β€” Reverse Engineer Any UI in One Click

Scan any website β†’ Extract its exact design system β†’ Generate AI-ready rebuild prompts

Chrome Extension Plasmo Gemini AI TypeScript React License: MIT PRs Welcome


🎬 See UISnap in Action

πŸ‘† Click "Scan This Page" β†’ Watch colors, fonts, and layout get extracted in real time β†’ Copy the AI-optimized prompt β†’ Paste into v0, Lovable, or Cursor β†’ Get a pixel-perfect clone

Try it Now Β· Report Bug Β· Request Feature


πŸ“Έ Screenshots

Screenshots coming soon β€” scan any website and see the magic!


πŸ“– About

UISnap is a Chrome extension that performs UI reverse engineering. Point it at any website, click "Scan", and it will:

  1. Extract the exact design system β€” real hex colors, font families, font sizes, spacing, border-radius values β€” all read directly from the live CSS, not guessed by AI.
  2. Capture full-page screenshots β€” automatically scrolls the page and captures every viewport, with duplicate detection to avoid redundant frames.
  3. Analyze the layout with Gemini AI β€” sends the screenshots + extracted tokens to Google's Gemini 1.5 Flash model to understand the page structure, section hierarchy, hero types, gallery patterns, and navigation style.
  4. Generate platform-specific rebuild prompts β€” produces 4 highly detailed, expert-level prompts optimized for v0, Lovable, Cursor, and a Universal format that works with any AI tool.

The output isn't a generic "build me a landing page" prompt β€” it includes your exact colors, your exact fonts, your exact spacing, your real page headings, and section-by-section build instructions so the AI coding tool can produce a near-pixel-perfect clone.


πŸ’‘ Why I Built UISnap

As developers, we often see a beautiful website and think: "I want to build something like this." But recreating a UI from scratch is tedious:

  • Manually inspecting colors in DevTools? Slow.
  • Guessing font sizes? Inaccurate.
  • Describing layout to an AI? Vague.

UISnap bridges the gap. It automates the entire "reverse engineering" step β€” from CSS inspection to AI analysis β€” and hands you a ready-to-paste prompt that actually produces results. No more 20-minute DevTools sessions. No more generic prompts. Scan β†’ Copy β†’ Paste β†’ Build.


✨ Features

πŸ”¬ Live DOM Design Token Extraction

  • Reads actual CSS values via getComputedStyle β€” not screenshots, not guesses
  • Extracts: primary/secondary/accent colors, background, text color, all raw palette colors
  • Detects heading & body fonts, sizes, weights, and line heights
  • Measures section gaps, container padding, border-radius per element type (card, button, input)
  • Parses :root CSS custom properties for full design system coverage

πŸ“· Intelligent Full-Page Screenshot Capture

  • Auto-scrolls the entire page from top to bottom
  • Captures each viewport as a high-quality screenshot
  • Uses image hashing to detect duplicate frames (sticky footers, fixed backgrounds)
  • Sends up to 6 representative screenshots to the AI for analysis

🧠 Gemini AI Visual Analysis

  • Identifies: layout style, navigation pattern, design aesthetic, color mood
  • Maps every section (Hero, Features, Pricing, Testimonials, Footer, etc.)
  • Detects: hero type (static/carousel/text-only), gallery type (grid/masonry/stacked), footer type (minimal/multi-column)
  • Provides section-by-section descriptions for precise reconstruction

πŸ“ Expert-Level, Platform-Specific Prompts

Prompt Optimized For Tech Stack
V0 Prompt Vercel v0 Next.js 14, Tailwind CSS, shadcn/ui
Lovable Prompt Lovable.dev Vite, React 18, React Router, Framer Motion
Cursor Prompt Cursor IDE Next.js 14, file-by-file spec with folder structure
Universal Prompt Any AI tool Framework-agnostic, works with ChatGPT/Claude/etc.
Color Palette Designers CSS vars, Tailwind config, Figma Design Tokens JSON

πŸ•˜ Scan History

  • Saves your last 10 scans automatically to chrome.storage.local
  • Click any past scan to reload its full results β€” no need to re-scan
  • Shows URL, timestamp, and screenshot count for each entry

⚑ Live Progress Preview

  • Shows real-time color swatches as they're extracted from the page
  • Displays a live screenshot counter as the page scrolls
  • Dynamic status updates: "Extracting tokens..." β†’ "Capturing (3)..." β†’ "Analyzing with Gemini..."

πŸ”‘ Bring Your Own Key (BYOK)

  • Save your own Gemini API key in the Settings tab
  • Key is stored in chrome.storage.local and never displayed after saving
  • Bypasses the Cloudflare proxy for direct, faster API calls
  • Remove your key anytime with one click

πŸ”— Deep Links

  • V0 Prompt: Copies prompt + opens v0.dev/chat in a new tab
  • Lovable Prompt: Copies prompt + opens lovable.dev in a new tab
  • Other prompts: Copy to clipboard with visual confirmation

⚠️ Fallback Handling

  • If the content script can't read a heavily obfuscated page, tokens are marked as isFallback
  • A warning banner appears: "We had trouble reading this site's exact code. The AI will rely mostly on visual screenshots."
  • The scan still completes using AI vision as the primary data source

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        CHROME BROWSER                           β”‚
β”‚                                                                 β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    messages     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   Popup UI   β”‚ ◄────────────► β”‚   Background Service     β”‚  β”‚
β”‚  β”‚  (popup.tsx)  β”‚                β”‚   Worker (background.ts) β”‚  β”‚
β”‚  β”‚              β”‚                β”‚                          β”‚  β”‚
β”‚  β”‚  β€’ Scan Tab  β”‚                β”‚  β€’ Orchestrates scan     β”‚  β”‚
β”‚  β”‚  β€’ History   β”‚                β”‚  β€’ Takes screenshots     β”‚  β”‚
β”‚  β”‚  β€’ Settings  β”‚                β”‚  β€’ Calls Gemini API      β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β”‚  β€’ Saves history         β”‚  β”‚
β”‚                                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                                             β”‚                   β”‚
β”‚                                    messages β”‚                   β”‚
β”‚                                             β–Ό                   β”‚
β”‚                                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”‚
β”‚                                  β”‚   Content Script     β”‚      β”‚
β”‚                                  β”‚   (content.ts)       β”‚      β”‚
β”‚                                  β”‚                      β”‚      β”‚
β”‚                                  β”‚  β€’ Reads DOM/CSS     β”‚      β”‚
β”‚                                  β”‚  β€’ Scrolls page      β”‚      β”‚
β”‚                                  β”‚  β€’ Extracts tokens   β”‚      β”‚
β”‚                                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚
β”‚                                                                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
                   HTTPS    β”‚
                            β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚   Cloudflare Worker      β”‚
              β”‚   (worker/index.js)      β”‚         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                          β”‚ ──────► β”‚ Google Gemini β”‚
              β”‚  β€’ Hides API key         β”‚         β”‚ 1.5 Flash    β”‚
              β”‚  β€’ Proxies requests      β”‚ ◄────── β”‚              β”‚
              β”‚  β€’ CORS handling         β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚
                     OR (BYOK mode)
                            β”‚
              User's own API key ──────────────────► Google Gemini

πŸ› οΈ Tech Stack

Layer Technology Purpose
Framework Plasmo v0.90.5 Chrome extension framework with React support
UI React 18.2 + TypeScript 5.3 Popup interface with tabs and live preview
AI Google Gemini 1.5 Flash Visual layout analysis from screenshots
Proxy Cloudflare Workers Secure API key proxy (zero-cost serverless)
Storage chrome.storage.local Scan history, API key, session data
Screenshot chrome.tabs.captureVisibleTab Native Chrome screenshot API
CSS Analysis getComputedStyle + DOM traversal Direct CSS token extraction

πŸ“ Project Structure

uisnap/
β”œβ”€β”€ popup.tsx                    # Main popup UI β€” tabs, live preview, settings
β”œβ”€β”€ background.ts                # Service worker β€” scan orchestrator
β”œβ”€β”€ content.ts                   # Content script β€” injected into web pages
β”‚
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ScanButton.tsx           # Animated scan trigger button
β”‚   β”œβ”€β”€ ResultPanel.tsx          # Design tokens + analysis display
β”‚   └── ExportButtons.tsx        # Platform prompt buttons with deep links
β”‚
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ types.ts                 # TypeScript interfaces (DesignTokens, ScanResult, etc.)
β”‚   β”œβ”€β”€ extract.ts               # DOM/CSS design token extraction engine
β”‚   β”œβ”€β”€ capture.ts               # Full-page screenshot capture with dedup
β”‚   β”œβ”€β”€ gemini.ts                # Gemini API client (proxy + BYOK support)
β”‚   β”œβ”€β”€ prompt-builder.ts        # Platform-specific prompt generators
β”‚   └── crawler.ts               # Multi-page link discovery (experimental)
β”‚
β”œβ”€β”€ worker/
β”‚   └── index.js                 # Cloudflare Worker β€” secure Gemini API proxy
β”‚
β”œβ”€β”€ assets/
β”‚   └── icon.png                 # Extension icon
β”‚
β”œβ”€β”€ package.json                 # Dependencies and manifest config
β”œβ”€β”€ tsconfig.json                # TypeScript configuration
└── .prettierrc.mjs              # Code formatting rules

πŸš€ Installation

Prerequisites

  • Node.js 18+ (Download)
  • npm (comes with Node.js)
  • Google Chrome browser

Chrome Extension Setup

# 1. Clone the repository
git clone https://github.com/Darshan3690/UI_snap.git
cd UI_snap/uisnap

# 2. Install dependencies
npm install

# 3. Build for production
npm run build

Load into Chrome

  1. Open Chrome and navigate to chrome://extensions/
  2. Enable Developer mode (toggle in top-right corner)
  3. Click Load unpacked
  4. Select the uisnap/build/chrome-mv3-prod folder
  5. Pin the UISnap extension from the puzzle piece icon

Gemini API Setup (Optional β€” BYOK)

By default, UISnap uses a shared Cloudflare Worker proxy. For better performance and no rate limits, use your own key:

  1. Go to Google AI Studio
  2. Create a new API key (free tier available)
  3. Open UISnap β†’ Settings tab
  4. Paste your key and click Save API Key
  5. Your key is stored securely in chrome.storage.local and hidden from the UI

▢️ Running the Project

Development Mode (with hot reload)

cd uisnap
npm run dev

This starts Plasmo's dev server. Load the extension from uisnap/build/chrome-mv3-dev in Chrome. Changes to your source files will automatically reload the extension.

Production Build

npm run build

Output goes to uisnap/build/chrome-mv3-prod. Load this folder in Chrome for the optimized build.

Package for Distribution

npm run package

Creates a .zip file ready for Chrome Web Store submission.


πŸ“– How to Use

Step 1: Scan a Website

  1. Navigate to any website in Chrome
  2. Click the UISnap extension icon
  3. Click "Scan This Page"
  4. Watch the live preview as tokens are extracted and screenshots are captured

Step 2: Review Results

  • Color swatches β€” see the exact hex codes extracted from CSS
  • Typography β€” heading and body font families with sizes
  • Analysis β€” AI-detected layout style, sections, and patterns
  • Prompt preview β€” a snippet of the generated prompt

Step 3: Copy & Build

  • Click "V0 Prompt" β†’ Prompt copied + v0.dev opens automatically
  • Click "Lovable Prompt" β†’ Prompt copied + lovable.dev opens automatically
  • Click "Cursor Prompt" β†’ Copy and paste into Cursor IDE
  • Click "Universal Prompt" β†’ Works with ChatGPT, Claude, or any AI

Step 4: Reload from History

  • Switch to the History tab to see your last 10 scans
  • Click any entry to instantly reload its results

πŸ“ Prompt Types β€” What Makes Them Different

πŸ”΅ V0 Prompt (Vercel)

  • Tech: Next.js 14 App Router + Tailwind CSS + shadcn/ui
  • Includes: Tailwind config color block, real page headings, section-by-section instructions
  • Best for: Quick, beautiful single-page prototypes

🟣 Lovable Prompt

  • Tech: Vite + React 18 + React Router + Framer Motion
  • Includes: Multi-page app structure (Home, About, Services, Gallery, Contact)
  • Best for: Full multi-page web applications

🟠 Cursor Prompt

  • Tech: Next.js 14 + TypeScript + shadcn/ui
  • Includes: Exact folder structure, file-by-file spec, globals.css with CSS variables, tailwind.config.ts ready to copy
  • Best for: Developers who want a complete, production-grade codebase

βšͺ Universal Prompt

  • Tech: Framework-agnostic
  • Includes: Full design system with CSS custom properties, strict βœ“/βœ— rules, animation specs
  • Best for: Any AI tool (ChatGPT, Claude, Copilot, etc.)

🎨 Color Palette

  • Includes: Named colors, CSS :root variables, Tailwind config, Figma Design Tokens JSON
  • Best for: Designers importing into Figma or building a design system

πŸ”„ Workflow

  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  Visit   │────►│  Click   │────►│  UISnap   │────►│  Copy    β”‚
  β”‚  Website β”‚     β”‚  Scan    β”‚     β”‚  Analyzes β”‚     β”‚  Prompt  β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
                                                          β”‚
                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚
                  β”‚  Pixel-  │◄────│  Paste in β”‚β—„β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚  Perfect β”‚     β”‚  v0 / AI  β”‚
                  β”‚  Clone!  β”‚     β”‚  Tool     β”‚
                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ—ΊοΈ Roadmap

  • Core scan engine (DOM extraction + screenshots + Gemini)
  • Platform-specific prompts (v0, Lovable, Cursor, Universal)
  • Scan History (last 10 scans)
  • Live progress preview (color swatches + screenshot counter)
  • BYOK β€” Bring Your Own Gemini API Key
  • Deep links (auto-open v0.dev / lovable.dev)
  • Fallback handling for obfuscated sites
  • Multi-page crawl β€” scan linked pages automatically
  • Side-by-side comparison β€” original vs. generated UI
  • Export to Figma β€” generate a Figma file from tokens
  • Support OpenAI / Anthropic models β€” choose your AI provider
  • Chrome Web Store listing β€” one-click install
  • Firefox / Edge support β€” cross-browser extension
  • Team sharing β€” share scan results via link

🀝 Contributing

Contributions make open source amazing! Here's how you can help:

Quick Start

# Fork the repo, then:
git clone https://github.com/YOUR_USERNAME/UI_snap.git
cd UI_snap/uisnap
npm install
npm run dev

How to Contribute

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'feat: add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Contribution Ideas

Area Ideas
🎨 UI/UX Dark/light theme toggle, responsive popup redesign
🧠 AI Support for OpenAI GPT-4o, Anthropic Claude
πŸ“ Prompts New prompt templates for Bolt, Replit, WindSurf
πŸ”¬ Extraction Better color ranking, CSS animation detection
🌐 Browser Firefox WebExtension port, Edge support
πŸ“š Docs Video tutorials, example scan outputs

❓ FAQ

Is UISnap free?

Yes! UISnap is 100% free and open source. The default mode uses a shared Cloudflare Worker proxy with a free-tier Gemini API key. For unlimited usage, you can add your own free Gemini API key in Settings.

Does it work on any website?

It works on most websites. Some heavily obfuscated sites (canvas-based rendering, heavy JavaScript frameworks) may not yield perfect CSS extraction β€” in those cases, UISnap falls back to AI visual analysis and shows a warning banner.

Is my API key safe?

Yes. Your API key is stored locally in chrome.storage.local β€” it never leaves your browser except when making direct API calls to Google. It is never sent to our proxy server. After saving, the key is completely hidden from the UI.

Can I use it with ChatGPT or Claude instead of v0?

Absolutely! Use the Universal Prompt β€” it's framework-agnostic and works with any AI coding tool, including ChatGPT, Claude, Copilot, and more.

How accurate are the extracted colors?

Colors are read directly from the page's computed CSS via getComputedStyle β€” they are the exact hex/rgb values the browser renders, not AI-guessed approximations.

Why do I see "Scan failed" on some pages?

This usually happens on:

  • chrome:// internal pages (extensions can't access these)
  • Pages that block content scripts via CSP
  • PDF viewers or non-HTML content

Try scanning a regular website like stripe.com or apple.com.


πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.

You are free to use, modify, and distribute this project. Attribution is appreciated but not required.


πŸ’¬ Support

Having issues or questions?


⭐ Star This Repository

If UISnap helped you build something awesome, consider giving it a star!

Every star motivates me to keep improving UISnap πŸš€

Star on GitHub


Built with ❀️ by Darshan

Scan. Copy. Build. Ship.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages