- AI Academy
- Posts
- 📚 Recreating Web Designs from Screenshots with AI
📚 Recreating Web Designs from Screenshots with AI
How We Upgraded Our Newsletter Using Claude's Artifacts
Reading Time: 4 minutes
Welcome to the first edition of our new AI education series!
Alongside our regular AI news roundup, we're launching this practical learning initiative. We'll share our experiments, tutorials, backstories, and tool reviews, showing you what's possible with today's AI tools and helping you learn from our successes and mistakes.
Let us know your thoughts in the poll at the bottom.
Why Use Claude's Artifacts to Turn Designs into Code
At AI Academy, we've been thinking about how to improve the look of our commentary section in the AI news newsletters for a while. Our CMO found an example we all loved, but unfortunately, our newsletter platform didn't allow us to re-create it with standard functions.
For reference: https://www.europeancorrespondent.com/
The only solution was to write code.
While we have a team member with coding skills, we don't want to rely on him for every small change. This situation prompted us to put Claude's Artifacts feature to use for the first time.
This tutorial shares our experience using Artifacts to turn a design into code. We'll walk you through our process, including what worked and what didn't. You can then use this method to apply new designs to your website, newsletter, or any other web project.
ℹ️ Artifacts in Claude 3.5 Sonnet help you manage large pieces of content such as code or designs by opening a new window on the right side of the conversation panel. This makes creating and editing easier. To turn it on, go to "Feature Preview" in your account settings.
Generating Code from an Image Using Claude's Artifacts
Now that you know why we turned to Claude's Artifacts in the first place, we demonstrate how to use it to create code based on an image input. We use our experience of creating the new comment section for the AI Academy newsletter as a running example.
1) Prepare Your Design: We started with the screenshot shared, which had the comment style we wanted. We noted down the colors we wanted in hex codes and fonts to use.
2) Craft a Detailed Prompt: We uploaded the image to Claude and added a descriptive prompt. Here's the structure we used:
Generate HTML code to replicate the design in the image I just uploaded. The key elements to focus on are the circular profile picture, speech bubble shape, and overall layout. Use these colors: [we listed our color hex codes]. Use these fonts: [we specified our fonts].
Prompt plus uploaded image to Claude
3) Preview and Refine: After Claude generated the code in the right window, we used the preview button in the top right to check the design. The spacing and speech bubble shape weren't right at first. It took a few iterations, but we eventually got the comment section looking just right.
One of the first outcomes. Not exactly right.
4) Test and Implement: Finally, we integrated the final code into our email newsletter template. We then tested it through our email client to ensure compatibility before implementing it.
This is the final result, taken from our last newsletter.
Key Learnings:
The generated code worked well in preview mode but had alignment issues in actual emails. Gianluca's suggestion to use span elements resolved this. In this case, coding experience helped!
We found that providing a direct URL for the profile picture was crucial for proper display in email clients.
While it took some back-and-forth with Claude, this process was still much faster than coding from scratch, especially for those of us without a coding background.
This method can be applied to various design elements, making it a versatile tool for quickly turning visual designs into functional code.
How to Apply Claude's Artifacts to Your Work
Now that you've seen how we used Claude's Artifacts for our newsletter design, let's explore other ways you can apply this powerful tool in your work:
Documents and Code:
Create and format reports, articles, or documentation in Markdown or plain text.
Generate and iterate on code snippets for various programming languages.
Web Development:
Quickly prototype landing pages or simple web interfaces with single-page HTML.
Develop and test interactive React components for dynamic web applications.
Visual Content:
Design scalable vector graphics (SVG) for logos, icons, or illustrations.
Create diagrams and flowcharts to visualize data or concepts.
The ability to instantly generate and refine content in these formats can significantly boost your productivity and help you tackle complex tasks more efficiently.
How did you find this series? |
Want to get even more practical? Explore hands-on AI learning with AI Academy:
Generative AI Project Bootcamp: Create AI prototypes to solve real business problems.
Corporate Training: Tailored AI training for your team.
Practical Introduction to ChatGPT: Free course on effectively using ChatGPT.
We'll be back with more AI tips soon!