Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Comprehensive AI design skill providing design intelligence across platforms with 161 reasoning rules.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
scripts/cip/render-html.py
1#!/usr/bin/env python32# -*- coding: utf-8 -*-3"""4CIP HTML Presentation Renderer56Generates a professional HTML presentation from CIP mockup images7with detailed descriptions, concepts, and brand guidelines.8"""910import argparse11import json12import os13import sys14import base6415from pathlib import Path16from datetime import datetime1718# Add parent directory for imports19sys.path.insert(0, str(Path(__file__).parent))20from core import search, get_cip_brief2122# Deliverable descriptions for presentation23DELIVERABLE_INFO = {24"business card": {25"title": "Business Card",26"concept": "First impression touchpoint for professional networking",27"purpose": "Creates memorable brand recall during business exchanges",28"specs": "Standard 3.5 x 2 inches, premium paper stock"29},30"letterhead": {31"title": "Letterhead",32"concept": "Official correspondence identity",33"purpose": "Establishes credibility and professionalism in written communications",34"specs": "A4/Letter size, digital and print versions"35},36"document template": {37"title": "Document Template",38"concept": "Branded document system for internal and external use",39"purpose": "Ensures consistent brand representation across all documents",40"specs": "Multiple formats: Word, PDF, Google Docs compatible"41},42"reception signage": {43"title": "Reception Signage",44"concept": "Brand presence in physical office environment",45"purpose": "Creates strong first impression for visitors and reinforces brand identity",46"specs": "3D dimensional letters, backlit LED options, premium materials"47},48"office signage": {49"title": "Office Signage",50"concept": "Wayfinding and brand presence system",51"purpose": "Guides visitors while maintaining consistent brand experience",52"specs": "Modular system with directional and informational signs"53},54"polo shirt": {55"title": "Polo Shirt",56"concept": "Professional team apparel",57"purpose": "Creates unified team identity and brand ambassadorship",58"specs": "Premium pique cotton, embroidered logo on left chest"59},60"t-shirt": {61"title": "T-Shirt",62"concept": "Casual brand apparel",63"purpose": "Extends brand reach through everyday wear and promotional events",64"specs": "High-quality cotton, screen print or embroidery options"65},66"vehicle": {67"title": "Vehicle Branding",68"concept": "Mobile brand advertising",69"purpose": "Transforms fleet into moving billboards for maximum visibility",70"specs": "Partial or full wrap, vinyl graphics, weather-resistant"71},72"van": {73"title": "Van Branding",74"concept": "Commercial vehicle identity",75"purpose": "Professional fleet presence for service and delivery operations",76"specs": "Full wrap design, high-visibility contact information"77},78"car": {79"title": "Car Branding",80"concept": "Executive vehicle identity",81"purpose": "Professional presence for corporate and sales teams",82"specs": "Subtle branding, door panels and rear window"83},84"envelope": {85"title": "Envelope",86"concept": "Branded mail correspondence",87"purpose": "Extends brand identity to all outgoing mail",88"specs": "DL, C4, C5 sizes with logo placement"89},90"folder": {91"title": "Presentation Folder",92"concept": "Document organization with brand identity",93"purpose": "Professional presentation of proposals and materials",94"specs": "A4/Letter pocket folder with die-cut design"95}96}979899def get_image_base64(image_path):100"""Convert image to base64 for embedding in HTML"""101try:102with open(image_path, "rb") as f:103return base64.b64encode(f.read()).decode('utf-8')104except Exception as e:105print(f"Warning: Could not load image {image_path}: {e}")106return None107108109def get_deliverable_info(filename):110"""Extract deliverable type from filename and get info"""111filename_lower = filename.lower()112for key, info in DELIVERABLE_INFO.items():113if key.replace(" ", "-") in filename_lower or key.replace(" ", "_") in filename_lower:114return info115# Default info116return {117"title": filename.replace("-", " ").replace("_", " ").title(),118"concept": "Brand identity application",119"purpose": "Extends brand presence across touchpoints",120"specs": "Custom specifications"121}122123124def generate_html(brand_name, industry, images_dir, output_path=None, style=None):125"""Generate HTML presentation from CIP images"""126127images_dir = Path(images_dir)128if not images_dir.exists():129print(f"Error: Directory not found: {images_dir}")130return None131132# Get all PNG images133images = sorted(images_dir.glob("*.png"))134if not images:135print(f"Error: No PNG images found in {images_dir}")136return None137138# Get CIP brief for brand info139brief = get_cip_brief(brand_name, industry, style)140style_info = brief.get("style", {})141industry_info = brief.get("industry", {})142143# Build HTML144html_parts = [f'''<!DOCTYPE html>145<html lang="en">146<head>147<meta charset="UTF-8">148<meta name="viewport" content="width=device-width, initial-scale=1.0">149<title>{brand_name} - Corporate Identity Program</title>150<style>151* {{152margin: 0;153padding: 0;154box-sizing: border-box;155}}156body {{157font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;158background: #0a0a0a;159color: #ffffff;160line-height: 1.6;161}}162.hero {{163min-height: 100vh;164display: flex;165flex-direction: column;166justify-content: center;167align-items: center;168text-align: center;169padding: 4rem 2rem;170background: linear-gradient(135deg, #1a1a2e 0%, #0a0a0a 100%);171}}172.hero h1 {{173font-size: 4rem;174font-weight: 700;175letter-spacing: -0.02em;176margin-bottom: 1rem;177background: linear-gradient(135deg, #ffffff 0%, #888888 100%);178-webkit-background-clip: text;179-webkit-text-fill-color: transparent;180}}181.hero .subtitle {{182font-size: 1.5rem;183color: #888;184margin-bottom: 3rem;185}}186.hero .meta {{187display: flex;188gap: 3rem;189flex-wrap: wrap;190justify-content: center;191}}192.hero .meta-item {{193text-align: center;194}}195.hero .meta-label {{196font-size: 0.75rem;197text-transform: uppercase;198letter-spacing: 0.1em;199color: #666;200margin-bottom: 0.5rem;201}}202.hero .meta-value {{203font-size: 1rem;204color: #ccc;205}}206.section {{207padding: 6rem 2rem;208max-width: 1400px;209margin: 0 auto;210}}211.section-title {{212font-size: 2.5rem;213font-weight: 600;214margin-bottom: 1rem;215color: #fff;216}}217.section-subtitle {{218font-size: 1.1rem;219color: #888;220margin-bottom: 4rem;221max-width: 600px;222}}223.deliverable {{224display: grid;225grid-template-columns: 1fr 1fr;226gap: 4rem;227margin-bottom: 8rem;228align-items: center;229}}230.deliverable:nth-child(even) {{231direction: rtl;232}}233.deliverable:nth-child(even) > * {{234direction: ltr;235}}236.deliverable-image {{237position: relative;238border-radius: 16px;239overflow: hidden;240box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);241}}242.deliverable-image img {{243width: 100%;244height: auto;245display: block;246}}247.deliverable-content {{248padding: 2rem 0;249}}250.deliverable-title {{251font-size: 2rem;252font-weight: 600;253margin-bottom: 1rem;254color: #fff;255}}256.deliverable-concept {{257font-size: 1.1rem;258color: #aaa;259margin-bottom: 1.5rem;260font-style: italic;261}}262.deliverable-purpose {{263font-size: 1rem;264color: #888;265margin-bottom: 1.5rem;266line-height: 1.8;267}}268.deliverable-specs {{269display: inline-block;270padding: 0.5rem 1rem;271background: rgba(255, 255, 255, 0.05);272border-radius: 8px;273font-size: 0.85rem;274color: #666;275}}276.color-palette {{277display: flex;278gap: 1rem;279margin-top: 2rem;280}}281.color-swatch {{282width: 60px;283height: 60px;284border-radius: 12px;285box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);286}}287.footer {{288text-align: center;289padding: 4rem 2rem;290border-top: 1px solid #222;291color: #666;292}}293.footer p {{294margin-bottom: 0.5rem;295}}296@media (max-width: 900px) {{297.hero h1 {{298font-size: 2.5rem;299}}300.deliverable {{301grid-template-columns: 1fr;302gap: 2rem;303}}304.deliverable:nth-child(even) {{305direction: ltr;306}}307}}308</style>309</head>310<body>311<section class="hero">312<h1>{brand_name}</h1>313<p class="subtitle">Corporate Identity Program</p>314<div class="meta">315<div class="meta-item">316<div class="meta-label">Industry</div>317<div class="meta-value">{industry_info.get("Industry", industry.title())}</div>318</div>319<div class="meta-item">320<div class="meta-label">Style</div>321<div class="meta-value">{style_info.get("Style Name", "Corporate")}</div>322</div>323<div class="meta-item">324<div class="meta-label">Mood</div>325<div class="meta-value">{style_info.get("Mood", "Professional")}</div>326</div>327<div class="meta-item">328<div class="meta-label">Deliverables</div>329<div class="meta-value">{len(images)} Items</div>330</div>331</div>332</section>333334<section class="section">335<h2 class="section-title">Brand Applications</h2>336<p class="section-subtitle">337Comprehensive identity system designed to maintain consistency338across all brand touchpoints and communications.339</p>340''']341342# Add each deliverable343for i, image_path in enumerate(images):344info = get_deliverable_info(image_path.stem)345img_base64 = get_image_base64(image_path)346347if img_base64:348img_src = f"data:image/png;base64,{img_base64}"349else:350img_src = str(image_path)351352html_parts.append(f'''353<div class="deliverable">354<div class="deliverable-image">355<img src="{img_src}" alt="{info['title']}" loading="lazy">356</div>357<div class="deliverable-content">358<h3 class="deliverable-title">{info['title']}</h3>359<p class="deliverable-concept">{info['concept']}</p>360<p class="deliverable-purpose">{info['purpose']}</p>361<span class="deliverable-specs">{info['specs']}</span>362</div>363</div>364''')365366# Close HTML367html_parts.append(f'''368</section>369370<footer class="footer">371<p><strong>{brand_name}</strong> Corporate Identity Program</p>372<p>Generated on {datetime.now().strftime("%B %d, %Y")}</p>373<p style="margin-top: 1rem; font-size: 0.8rem;">Powered by CIP Design Skill</p>374</footer>375</body>376</html>377''')378379html_content = "".join(html_parts)380381# Save HTML382output_path = output_path or images_dir / f"{brand_name.lower().replace(' ', '-')}-cip-presentation.html"383output_path = Path(output_path)384385with open(output_path, "w", encoding="utf-8") as f:386f.write(html_content)387388print(f"✅ HTML presentation generated: {output_path}")389return str(output_path)390391392def main():393parser = argparse.ArgumentParser(394description="Generate HTML presentation from CIP mockups",395formatter_class=argparse.RawDescriptionHelpFormatter,396epilog="""397Examples:398# Generate HTML from CIP images directory399python render-html.py --brand "TopGroup" --industry "consulting" --images ./topgroup-cip400401# Specify output path402python render-html.py --brand "TopGroup" --industry "consulting" --images ./cip --output presentation.html403"""404)405406parser.add_argument("--brand", "-b", required=True, help="Brand name")407parser.add_argument("--industry", "-i", default="technology", help="Industry type")408parser.add_argument("--style", "-s", help="Design style")409parser.add_argument("--images", required=True, help="Directory containing CIP mockup images")410parser.add_argument("--output", "-o", help="Output HTML file path")411412args = parser.parse_args()413414generate_html(415brand_name=args.brand,416industry=args.industry,417images_dir=args.images,418output_path=args.output,419style=args.style420)421422423if __name__ == "__main__":424main()425