Back to Blog
January 17, 20267 min readAngular Material Theming

Angular Material Theming from UI Demonstration Videos

R
Replay Team
Developer Advocates

TL;DR: Replay allows you to capture Angular Material theming from UI demonstration videos, generating working code and styles, saving you hours of manual implementation.

Stop manually transcribing Angular Material theming from UI demos. It's tedious, error-prone, and frankly, a waste of valuable developer time. Screenshots-to-code tools offer a sliver of help, but they miss the crucial element: behavior. They can't understand the why behind the UI, leading to incomplete and often broken code.

Enter Replay, a revolutionary video-to-code engine that uses Gemini to reconstruct working UIs from screen recordings. Replay analyzes video – not just static images – to understand user behavior and intent. This "Behavior-Driven Reconstruction" approach treats the video as the source of truth, capturing not just the visual appearance but also the interaction patterns and underlying logic. This is especially powerful when translating Angular Material theming from demo videos into your own projects.

The Problem with Traditional Approaches#

Traditional methods for adopting Angular Material theming from demos are painfully slow:

  1. Watching and pausing: Repeatedly pausing the video to inspect CSS, component structures, and Angular Material theme configurations.
  2. Manual transcription: Copying and pasting code snippets, often introducing typos and inconsistencies.
  3. Trial and error: Experimenting with different theme settings to achieve the desired look and feel, which is time-consuming and frustrating.
  4. Contextual understanding: Deciphering the developer's intent behind specific UI choices, which is often lost in translation.

These methods are not only inefficient but also prone to errors, leading to significant delays and increased development costs.

Replay: Behavior-Driven Angular Material Theming#

Replay offers a dramatically different approach. By analyzing video, Replay understands the dynamic behavior of the UI, allowing it to accurately reconstruct the Angular Material theming implementation.

Here's how Replay works:

  1. Video Capture: Record a video of the Angular Material theme demo you want to replicate. Ensure the video clearly showcases the different theme variations and interactions.
  2. Replay Analysis: Upload the video to Replay. Our engine uses Gemini to analyze the video, identifying Angular Material components, theme configurations, and interaction patterns.
  3. Code Generation: Replay generates working Angular code, including:
    • text
      scss
      files with custom theme definitions
    • Angular component templates with Material components
    • TypeScript code for handling theme switching and dynamic styling
  4. Integration: Seamlessly integrate the generated code into your Angular project.

Key Features for Angular Material Theming#

  • Multi-page generation: Replay can analyze multi-page demos, capturing the theme consistency across different sections of the application.
  • Supabase integration: Easily store and manage your themes in Supabase, allowing for dynamic theme loading and customization.
  • Style injection: Inject custom styles to fine-tune the theme and achieve the exact look and feel you desire.
  • Product Flow maps: Understand the user flow within the demo, allowing you to apply the theme consistently across your application's navigation.

Replay vs. Traditional Methods and Screenshot-to-Code#

Let's compare Replay with traditional manual transcription and screenshot-to-code tools:

FeatureManual TranscriptionScreenshot-to-CodeReplay
Video Input
Behavior AnalysisPartial
Angular Material Aware✅ (Understands Material Design)
Theme ExtractionTedious Manual WorkLimitedAutomated
Code AccuracyLowMediumHigh
Time SavingsMinimalModerateSignificant

📝 Note: "Angular Material Aware" means the tool understands the structure and conventions of Angular Material themes, leading to more accurate and maintainable code.

Here's another comparison, this time focusing on specific code generation capabilities:

FeatureManual TranscriptionScreenshot-to-CodeReplay
text
_theming.scss
Generation
Manual CreationLimitedAutomated generation of theme files
Component Template GenerationManual CreationPartialFull component template generation
Theme Switching LogicManual ImplementationNoneAutomated generation of logic

A Practical Example: Generating an Angular Material Theme from a Demo Video#

Let's say you have a video demonstrating a beautiful dark theme implemented using Angular Material. Here's how you can use Replay to generate the theme code:

Step 1: Record the Demo Video#

Capture a clear video of the Angular Material theme demo, showcasing all the different components and theme variations.

Step 2: Upload to Replay#

Upload the video to the Replay platform.

Step 3: Review and Adjust (If Necessary)#

Replay will analyze the video and generate the code. Review the generated code and make any necessary adjustments. Replay's intuitive interface allows you to easily modify the code and preview the changes.

Step 4: Integrate into Your Project#

Copy and paste the generated code into your Angular project.

Here's an example of the generated

text
_theming.scss
file:

scss
// _theming.scss @import '~@angular/material/theming'; @include mat-core(); $dark-primary: mat-palette($mat-indigo); $dark-accent: mat-palette($mat-pink, A200, A100, A400); $dark-warn: mat-palette($mat-red); $dark-theme: mat-dark-theme(( color: ( primary: $dark-primary, accent: $dark-accent, warn: $dark-warn, ) )); .dark-theme { @include angular-material-theme($dark-theme); }

And here's an example of a generated component template:

html
<!-- example.component.html --> <div class="example-container mat-elevation-z8"> <mat-toolbar color="primary"> <span>My App</span> </mat-toolbar> <mat-card> <mat-card-header> <mat-card-title>Welcome!</mat-card-title> </mat-card-header> <mat-card-content> <p> This is a sample Angular Material component. </p> </mat-card-content> <mat-card-actions> <button mat-button>LIKE</button> <button mat-button>SHARE</button> </mat-card-actions> </mat-card> </div>

💡 Pro Tip: Replay can often identify and extract custom color palettes defined in the demo, ensuring your generated theme accurately reflects the original design.

⚠️ Warning: While Replay significantly reduces manual effort, always review the generated code to ensure it meets your specific project requirements and coding standards.

Beyond Basic Theming: Advanced Use Cases#

Replay can handle more complex theming scenarios, including:

  • Dynamic theme switching: Generating code for toggling between light and dark themes.
  • Custom component styling: Capturing and applying custom styles to individual Angular Material components.
  • Accessibility considerations: Ensuring the generated theme adheres to accessibility guidelines.

Here's an example of code generated for dynamic theme switching:

typescript
// app.component.ts import { Component } from '@angular/core'; import { OverlayContainer } from '@angular/cdk/overlay'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) export class AppComponent { isDarkTheme = false; constructor(private overlayContainer: OverlayContainer) {} toggleTheme() { this.isDarkTheme = !this.isDarkTheme; if (this.isDarkTheme) { this.overlayContainer.getContainerElement().classList.add('dark-theme'); } else { this.overlayContainer.getContainerElement().classList.remove('dark-theme'); } } }

Frequently Asked Questions#

Is Replay free to use?#

Replay offers a free tier with limited usage. Paid plans are available for more extensive use and advanced features.

How is Replay different from v0.dev?#

While both tools aim to generate code, Replay uniquely analyzes video to understand user behavior, leading to more accurate and complete code generation, especially for complex UI interactions and theming. v0.dev primarily uses text prompts and existing UI libraries, lacking the behavioral insight derived from video analysis. Replay is designed to understand the intent behind the UI demonstrated in the video.

What types of videos can Replay analyze?#

Replay can analyze screen recordings of web applications, UI demos, and even instructional videos. The clearer the video, the more accurate the code generation will be.

What frameworks are supported?#

Currently, Replay supports Angular, React, and Vue.js. Support for other frameworks is planned for the future.


Ready to try behavior-driven code generation? Get started with Replay - transform any video into working code in seconds.

Ready to try Replay?

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

Launch Replay Free