The pale background covers more than 90% of the img2ui screenshot. Charcoal accounts for only 0.5% of the pixels sampled across the screenshot, yet it gives the primary “Get Started →” button its fill. Dropping a screenshot into a standard color picker easily pulls out the background; turning that screen into a button another designer can edit in Figma and an engineer can build in CSS still requires someone to decide which color means primary action.
Using the public homepage of Collective 353’s own tool img2ui (v0.4 beta, 2560 × 1440 px) as a concrete reference, this note follows that single primary action button from raw pixels all the way to Figma nodes and frontend specifications.
Extracting a palette from pixels: largest area does not mean primary action color

The public homepage is visually restrained: a large off-white canvas, an upload zone on the right with a light olive-green border, the headline “Design System” accented in olive green, a dark charcoal primary button (“Get Started →”) with white text on the left, and a light-bordered secondary button (“Browse Gallery”) beside it.
Right after an image is uploaded, img2ui runs its first step locally in the browser with no server upload and no AI call. It downsamples the image to a 160×160 canvas, skips transparent pixels, samples every 4th pixel, quantizes RGB values into buckets of 28, and selects up to 7 representative colors with a pairwise RGB Euclidean distance of at least 48, guaranteeing at least one light swatch and one dark swatch in the palette.
On this 2560×1440 homepage, that algorithm extracts the following 7 representative colors ordered by pixel share:
#fcfcfc90.9%252.0Largest area on screen, yet only the page background—never the primary action color#e0e0e02.6%224.0Light neutral tint for upload area and cards#c4c4c41.4%196.0Subtle borders and neutral transitions#a8a8a81.0%168.0Secondary icons and muted gray#1c1c1c0.5%28.0Actual fill of the "Get Started →" primary button; this color accounts for 0.5% of all sampled pixels#8c8c8c0.4%140.0Secondary body gray#5454540.4%84.0Dark body text gray
This sample highlights two limits of pure pixel extraction. First, the largest color (#fcfcfc, 90.9%) is almost always the page background rather than a button. When auto-assigning semantic slots, img2ui never treats the top pixel share as primary; instead, it ranks candidates by saturation and filters for mid-luminance swatches (luminance between 40 and 200) to populate primary, secondary, and accent.
Second, mid-luminance heuristics still miss minimalist monochrome interfaces. On this homepage, the olive-green headline covers too few pixels to enter the top 7 buckets, while the actual primary button fill #1c1c1c has a luminance of 28 (below 40) and gets filtered out. The initial auto-draft temporarily assigns #c4c4c4 as primary, then darkens it to #8e8e8e during light-theme contrast adjustment to meet the 3.0:1 minimum against #ffffff.
That is why img2ui separates palette and semantic role confirmation into an explicit interactive step. Within seconds, the designer locks primary to #1c1c1c, sets secondary to #545454, and adds the olive-green brand accent #708c00. The algorithm narrows an image into a workable candidate set, while deciding which color represents action stays with the designer.
Deriving rules from the reference: what that same button looks like in tokens
- Pixel
Sample the #1c1c1c fill
- Role
Name it action.primary
- Handoff
Export CSS and Figma nodes
Once the designer confirms the color slots, img2ui derives two layers of rules at once.
The first layer generates both Light and Dark themes and checks contrast against their surfaces using the WCAG relative luminance formula (default floor 3.0:1), adjusting lightness while preserving hue whenever a pair falls short. Placing #1c1c1c on #ffffff yields a measured contrast of 17.04:1. If olive green #708c00 is used as primary instead, its contrast on white is 3.86:1: enough for UI components at 3.0:1, but below the 4.5:1 threshold for small text. In that case, the exported rule documentation appends a warning advising bold weight or a darker shade for small copy.
The second layer expands those base colors into dot-notated semantic tokens alongside derived typography, spacing, and border-radius scales. Back to the “Get Started →” button: when a frontend engineer builds the same button on the next screen, they pull from a structured mapping rather than loose hex codes:
| Rule category | Token name | Measured value (Light) | Meaning for design & engineering |
|---|---|---|---|
| Button fill | action.primary (maps to colors.primary) | #1c1c1c | Primary button fill, 17.04:1 contrast on white |
| Button text | text.onAction | #ffffff | Auto-selected white or dark gray based on primary luminance |
| Hover fill | action.primaryHover | rgba(28,28,28,0.85) | Initial translucent baseline generated by the system |
| Disabled fill | action.disabled | rgba(28,28,28,0.4) | Disabled state baseline |
| Focus ring | border.focus | rgba(28,28,28,0.5) | Keyboard focus indicator color |
| Body / button size | Body / Small | 16px (line-height 1.65) / 14px (line-height 1.55) | 6-step type scale from baseline width (Display 36px down to Caption 12px) |
| Spacing scale | spacing[0..7] | 4, 8, 12, 16, 24, 32, 48, 64 px | Reusable padding, group gaps, and section whitespace |
| Radius scale | radius.md | 8px | Standard button & input radius (also sm 4px, lg 16px, xl 24px, full 999px) |
Font families and type scale also need a designer’s review. Because a browser cannot recover licensed font files from raw pixels, img2ui defaults to Inter when no font is detected, and the standard wizard builds dual themes against a 1440×900 baseline (1.0 scale factor). If the reference screenshot comes from a dense enterprise dashboard or a narrow mobile screen, the designer should still check whether Body 16px / Small 14px matches the product’s density before locking the scale.
Where does AI step in? Separating local pixel math from optional Vision LLM passes
Hearing the name img2ui, many people expect a pipeline that throws a full screenshot at an LLM and asks for a complete design system. Instead, img2ui keeps deterministic computation inside the browser and isolates visual semantic analysis into optional AI passes.
Everything in the core workflow runs 100% locally in the browser with zero AI calls: image downsampling, bucketed quantization, HSL semantic scoring, WCAG contrast correction, Light/Dark dual-theme generation, live UI Kit preview rendering for 25 standard components, and file export. Original image files never leave the browser.
Optional Vision LLM passes only run when the user requests component annotation or whole-screen style profiling. When a user draws a bounding box around “Get Started →” and tags it button, only that cropped region is Base64-encoded and sent with a button-specific structured prompt requesting variant, bgColor, textColor, borderRadius, border, padding, fontSize, fontWeight, shadow, and visible label to the selected vision model (via Worker or developer API keys for Anthropic, OpenAI, Google Gemini, or OpenRouter). Returned keys are normalized first, such as unifying bg-color or bgcolor into backgroundColor and appending px to bare numbers, before writing into the component spec. A separate whole-screen pass asks for a styleProfile (rounded vs. sharp, compact vs. airy, flat vs. subtle shadow) and a list of visible components, filtering out hallucinated names outside the 25-component catalog so style notes and confidence scores are enriched without overwriting confirmed base swatches.
If AI is not configured, returns invalid JSON, or times out, a three-tier fallback keeps the workflow moving by switching to local pixel heuristics that estimate filled / outline / soft / ghost variants and corner radii from the crop’s background brightness, border color ratio, and aspect dimensions.
Even with Vision LLM enabled, one gap remains for humans to fill. A static screenshot only shows the button’s resting default state (dark charcoal fill, roughly 8px radius, bold white label). It does not contain hover, active, focus-visible, loading, or disabled states, and it cannot tell you whether labels exceeding two lines should wrap or truncate. img2ui supplies conservative baselines such as 85% opacity for action.primaryHover, while real interaction feedback and accessible focus rings still require design and engineering sign-off.
Handing off to Figma and frontend: comparing outputs for the same button
Once the rules are confirmed, img2ui compiles one intermediate representation (IR) into multiple formats so designers, frontend engineers, and coding agents read the exact same specification. Following Button/Primary, the deliverables line up across both tools.
1. Structured JSON and frontend tokens (design-system.json, SKILL.md / SKILL ZIP)
The SKILL ZIP exported for frontend developers or coding agents bundles SKILL.md, design-system.json, references/tokens.css, references/tokens.md, references/components.md, assets/font-import.html, and (when Tailwind is selected) assets/tailwind.config.js.
In references/tokens.css, the primary button becomes copy-paste CSS custom properties:
:root {
--color-primary: #1c1c1c;
--action-primary: #1c1c1c;
--action-primaryHover: rgba(28,28,28,0.85);
--text-onAction: #ffffff;
--radius-md: 8px;
}
In design-system.json, alongside top-level tokens and semanticTokens, annotating “Get Started →” preserves confidence: 0.9 (from AI style analysis) and the crop’s analyzedStyles under components.detected.button, letting engineers compare system-derived values against screenshot-measured values. Meanwhile, the standalone HTML preview renders all 25 components in two sections: token-generated standard variants on top (Primary / Secondary / Outline / Soft / Ghost / Accent / Disabled across XS–XL sizes), and a dashed-separator “ANNOTATED STYLE” block below whenever a component was cropped and analyzed.
2. Figma Plugin JSON and editable native nodes
Handing rules back to design cannot mean pasting a flat bitmap onto the canvas. img2ui’s Figma JSON outputs two sections: top-level tokens (used by the plugin to create Color and Text Styles) and a nodes tree carrying Auto-Layout settings, padding, corner radii, and text styles.
The same Button/Primary looks like this in the exported Figma JSON:
{
"type": "FRAME",
"name": "Button/Primary",
"layout": {
"mode": "HORIZONTAL",
"padding": [6, 14, 6, 14],
"align": "center",
"justify": "center"
},
"children": [
{
"type": "TEXT",
"content": "Primary",
"font": { "family": "Inter", "weight": 600, "size": 11 },
"color": "#ffffff"
}
],
"cornerRadius": 8,
"fills": [{ "hex": "#1c1c1c" }]
}
When a designer pastes this JSON into the img2ui plugin on Figma Community, the plugin validates the payload, handles font loading and fallbacks, and rebuilds native editable Auto-Layout frames, swatch cards, and component sections (Palette, Typography, Navbar, Button, Card, Input, Alert, Badge, Tabs, Toggle, Checkbox, Pagination, Modal, Avatar, Toast, and more) rather than rasterized images.
3. Changing one color in practice: tracking every place that updates
The practical test of handoff quality is how many places a team has to touch when a client asks to change the primary button from dark charcoal #1c1c1c to brand olive green #708c00. Tracing the actual data flow shows three distinct paths depending on when that request arrives.
Before exporting from img2ui
Update the primary color slot to #708c00 in the palette step. DS.colors.primary, action.primary, action.primaryHover, border.focus, all 25 HTML component previews, tokens.css, tailwind.config.js, and both tokens and the Button/Primary fill inside Figma JSON update together. text.onAction recalculates luminance automatically, and if contrast falls below 4.5:1, the exported SKILL.md appends a contrast warning.
After exporting and handing off to frontend
Update --color-primary in references/tokens.css (or colors.primary in tailwind.config.js) along with the derived --action-primary* tokens, and every button and focus ring bound to semantic variables updates in one pass. Watch out for one manual trap: if an engineer hardcoded #1c1c1c straight from a single-crop components.md analysis, that instance will not follow the token update, so annotated hex values should always be mapped back to semantic variables during handoff.
After importing into Figma via the plugin
Update the Figma Color Style (or rebind to Figma Variables) and apply it to the button component so all primary button instances using that Style or Variable update together. Because node fills in Figma JSON carry concrete hex values (#1c1c1c) by default, designers should promote Button/Primary into a formal Component right after import and confirm its fill is bound to the Style so local nodes do not drift later.
What can you reuse today, and what still belongs to the designer?
Between launching v0.4 beta on March 17, 2026 (2026/03/17) and August 27, 2026, img2ui logged 49 registered accounts, 467 saved design systems, and 662 component analysis requests in its public environment (anonymous aggregate statistics; see the case study for details). Building the product and running it on real client work has made the boundary of automation clear.
What you can reuse right away is a structured v1 baseline: color slots, initial WCAG contrast checks, Light and Dark themes, type and spacing scales, and starter previews for 25 common components. Because one source compiles into design-system.json, tokens.css, tailwind.config.js, SKILL.md, DESIGN.md, and editable Figma nodes, designers, engineers, and coding agents work from the same file instead of interpreting one screenshot three different ways.
Three areas still belong to the designer and team. First is semantic role ownership: deciding which color means primary action versus decoration or warning, as seen above where #fcfcfc took 90.9% of pixels as the background while charcoal #1c1c1c made up 0.5% of the sample and carried the primary button. Second is interactive and edge states (hover, active, focus-visible, loading, disabled, validation errors, and long-text wrapping), none of which appear in a static screenshot. Third is typography licensing and naming conventions, including multilingual typeface pairing, internal naming habits (such as cta vs. solid-brand for Button/Primary), and multi-brand Figma Variables structure.
Running a screenshot through img2ui compresses the slowest, most error-prone step of bootstrapping from a blank file down to a few minutes, leaving designers and engineers more room to settle semantics, states, and interaction details.
Further reading & services
- Related note: Once base tokens and mockups are locked, how do you turn the 7 invisible input states, IME behavior, and API contracts into code an enterprise team can take over directly? Read What does handoff-ready, pixel-perfect frontend code actually look like?
- Case study: img2ui: Screenshot-to-design-system tool and Figma plugin (features, architecture, and live tool link)
- Services: UX and UI design, from requirements discovery and information architecture to interactive prototypes and handoff-ready UI specs
- Get in touch: Working on a product interface or design-system handoff? Contact Collective 353 to discuss your project
