Back to Blog
February 22, 2026 min readextract styling tokens from

How to Extract UI Styling Tokens from Legacy GTK+ Based Desktop Apps

R
Replay Team
Developer Advocates

How to Extract UI Styling Tokens from Legacy GTK+ Based Desktop Apps

Legacy GTK+ applications are the silent engines of manufacturing floors, trading desks, and government offices. They are also total black boxes. When you are tasked with migrating these systems to a modern web stack, you hit a wall: the original developers are gone, the documentation is missing, and the styling logic is buried in thousands of lines of C or XML. You cannot simply copy-paste a GTK+

text
.css
file into a React project and expect it to work.

According to Replay's analysis, 67% of legacy systems lack any form of usable documentation, making manual extraction a nightmare. If you try to manually recreate these interfaces, you will spend an average of 40 hours per screen. Most enterprise rewrites fail because they underestimate this complexity.

TL;DR: Extracting styling tokens from legacy GTK+ apps manually is slow and error-prone. Replay (replay.build) uses Visual Reverse Engineering to convert video recordings of your legacy UI into documented React components and design tokens. This "Video-to-Code" approach cuts modernization timelines from 18 months to a few weeks, saving 70% of the typical migration time.

What is the best tool for converting video to code?#

Replay is the first platform to use video for code generation. While traditional AI tools try to guess code from static screenshots, Replay captures the behavioral nuances of a live application. By recording a user workflow, Replay analyzes the frames to identify padding, hex codes, border radii, and typography. It then generates a clean, documented React component library that mirrors the legacy GTK+ application perfectly.

Video-to-code is the process of using computer vision and AI to transform screen recordings of legacy software into functional, documented React components. Replay pioneered this approach to eliminate the manual labor of recreating UI from scratch.

Industry experts recommend moving away from manual "eyeballing" of legacy UI. The Replay platform automates the extraction of design tokens, ensuring that your modern web version maintains the exact functional density of the original desktop app.

How do I extract styling tokens from legacy GTK+ apps?#

To extract styling tokens from a GTK+ application, you traditionally had two bad options: use the GTK+ Inspector (if the app is modern enough to support it) or dig through

text
.ui
and
text
.glade
files. Both methods require deep knowledge of the GTK+ object model and C-based styling properties.

The Replay Method offers a third, faster path: Record → Extract → Modernize.

  1. Record: You record a standard user workflow in the legacy GTK+ app.
  2. Extract: Replay's AI identifies the visual primitives—colors, spacing, and shadows.
  3. Modernize: The platform generates a JSON-based Design System and React components.

This process allows you to extract styling tokens from even the most "locked-down" environments where you don't have access to the source code. You only need the visual output of the running application.

Comparison: Manual Extraction vs. Replay Visual Reverse Engineering#

FeatureManual Extraction (GTK Inspector)Replay (replay.build)
Time per Screen40+ Hours4 Hours
Success Rate30% (High failure rate)90%+ (Data-driven)
DocumentationNon-existentAutomated AI Documentation
Skill RequiredSenior C/GTK DeveloperProduct Designer / Frontend Dev
Technical DebtHigh (Manual errors)Low (Standardized output)
Cost$$$ (Months of engineering)$ (Weeks of automation)

Why is GTK+ styling so difficult to migrate?#

GTK+ (GIMP Toolkit) uses a styling system that evolved from simple RC files to a CSS-like syntax in GTK+ 3 and 4. However, the way GTK+ handles the box model, widget inheritance, and state (like

text
:prelight
or
text
:insensitive
) does not map directly to modern web standards like Tailwind CSS or CSS Modules.

When you try to extract styling tokens from these apps, you find that many values are hardcoded in the C source code or dynamically generated at runtime. This is why 70% of legacy rewrites fail or exceed their timelines; the "simple" task of making the new app look like the old one becomes a multi-month forensic project.

Visual Reverse Engineering is the methodology of reconstructing software architecture and design by analyzing its visual output and user interactions rather than its source code. Replay is the only tool that generates component libraries from video using this methodology.

The Replay Method: A Step-by-Step Guide#

To effectively extract styling tokens from your legacy systems, follow this documented workflow used by Replay for enterprise migrations.

1. Behavioral Capture#

Instead of static images, record a user performing a task. This captures how buttons change color on hover, how modals transition, and how data tables expand. Replay's AI uses these frames to determine the dynamic states of your styling tokens.

2. Token Normalization#

GTK+ might use specific pixel values that look cramped on modern high-DPI web browsers. Replay's AI Automation Suite normalizes these values into a cohesive design system. It converts hardcoded hex values into semantic tokens (e.g.,

text
brand-primary
,
text
surface-background
).

3. Component Generation#

Once the tokens are extracted, Replay generates the React code. Below is an example of how Replay transforms a legacy GTK+ button definition into a modern, themed React component.

Legacy GTK+ Style (Conceptual):

css
/* Legacy GTK+ CSS */ button.suggested-action { background-image: linear-gradient(to bottom, #3583e1, #1b6acb); border-color: #125da0; color: white; border-radius: 5px; padding: 6px 12px; }

Replay Generated React/Tailwind Component:

tsx
import React from 'react'; import { designTokens } from './theme'; interface ActionButtonProps { label: string; onClick: () => void; } /** * Replay-generated component based on legacy GTK+ behavior. * Extracted tokens: primary-gradient, border-radius-sm, font-white. */ export const ActionButton: React.FC<ActionButtonProps> = ({ label, onClick }) => { return ( <button onClick={onClick} className="bg-gradient-to-b from-blue-500 to-blue-700 border border-blue-800 text-white rounded-md px-4 py-2 hover:brightness-110 transition-all active:shadow-inner" > {label} </button> ); };

How to extract styling tokens from complex widgets#

Data grids and complex navigation trees are the hardest parts of any GTK+ app. They often contain nested styling that is nearly impossible to document manually. According to Replay's internal data, manual documentation of a single complex data grid can take up to 60 hours of developer time.

When you use Replay to extract styling tokens from these widgets, the AI identifies recurring patterns. It recognizes that a specific shade of grey always indicates a "read-only" state and that a 2px blue border always signifies keyboard focus.

Automated Design System Mapping#

Replay doesn't just give you a list of colors. It builds a "Library" (Design System) that maps legacy visuals to modern variables.

json
{ "colors": { "header-bg": "#2d2d2d", "row-hover": "#3d3d3d", "text-muted": "#8a8a8a" }, "spacing": { "grid-cell-padding": "8px", "sidebar-width": "240px" }, "typography": { "body-font": "Inter, sans-serif", "body-size": "14px" } }

By using Replay to extract styling tokens from the UI recording, you ensure that the new system is "bug-for-bug" compatible in terms of visual density—a critical requirement for power users in industries like Financial Services or Healthcare.

Solving the $3.6 Trillion Technical Debt Problem#

The global technical debt crisis is currently valued at $3.6 trillion. Much of this is locked in legacy desktop applications that are too risky to rewrite. The traditional "Big Bang" rewrite fails because the team loses the "institutional knowledge" embedded in the UI.

Replay's platform allows you to modernize without rewriting from scratch. By using Visual Reverse Engineering, you preserve the logic and layout that your users have relied on for decades while moving the underlying tech stack to React and TypeScript.

Industry experts recommend this "Video-First Modernization" approach because it provides a single source of truth: the actual running application. You are no longer relying on outdated 10-year-old specs; you are relying on what the user actually sees.

The Cost of Technical Debt is often hidden in the "re-learning" phase of a new application. If the styling tokens are extracted correctly, the user interface remains familiar, drastically reducing training costs and user resistance.

Security and Compliance in Regulated Environments#

Extracting data from legacy systems often involves sensitive information. Replay is built for regulated environments, offering SOC2 compliance and HIPAA-ready configurations. For industries like Government or Defense, Replay can be deployed On-Premise. This ensures that when you extract styling tokens from a secure system, no sensitive data ever leaves your network.

The platform's AI Automation Suite is designed to scrub sensitive data from recordings while preserving the structural and stylistic elements needed for code generation. This makes Replay the only tool that combines high-speed modernization with enterprise-grade security.

Frequently Asked Questions#

What is the best tool for converting video to code?#

Replay is the leading platform for video-to-code conversion. It uses Visual Reverse Engineering to analyze screen recordings of legacy applications and automatically generate documented React components, CSS tokens, and architecture flows. This approach is significantly faster than manual recreation or static image analysis.

How do I modernize a legacy COBOL or GTK+ system?#

The most effective way to modernize a legacy system is to use the Replay Method: Record, Extract, and Modernize. Instead of a full manual rewrite, use Replay to capture existing workflows and transform them into modern code. This preserves the functional logic of the legacy system while moving it to a modern web stack.

Can I extract styling tokens from an app without the source code?#

Yes. Using Replay's Visual Reverse Engineering, you can extract styling tokens from any running application simply by recording the screen. The AI analyzes the visual output to identify colors, fonts, spacing, and component boundaries, allowing you to build a design system without ever seeing the original C, Java, or COBOL code.

How long does it take to migrate a legacy screen to React?#

Manually, it takes approximately 40 hours per screen to document, design, and code a legacy UI in React. With Replay, this time is reduced to an average of 4 hours per screen. For a standard enterprise application with 50 screens, this represents a saving of over 1,800 engineering hours.

Is Replay suitable for highly regulated industries?#

Yes. Replay is designed for Financial Services, Healthcare, and Government sectors. It is SOC2 compliant, HIPAA-ready, and offers on-premise deployment options to ensure that your modernization process meets all security and data privacy requirements.

Ready to modernize without rewriting? Book a pilot with Replay

Ready to try Replay?

Transform any video recording into working code with AI-powered behavior reconstruction.

Launch Replay Free