DEV Community

Cover image for How I Built an Instant Vector Brand Guidelines Generator in Next.js
Jeffrey Desenfans
Jeffrey Desenfans

Posted on

How I Built an Instant Vector Brand Guidelines Generator in Next.js

Creating brand guidelines manually is a tedious process for designers and developers alike. Setting up color palettes with exact CMYK/RGB values, typography scales, logo safety zones, and exporting print-ready vector PDFs takes hours of manual layout work in Adobe InDesign.

To automate this, I built BrandGuideMaker—a web tool that programmatically compiles brand assets and design tokens into print-ready vector brand books instantly.

Here is a breakdown of how the web application generates vector PDF documents dynamically on the fly.


The Problem with Traditional PDF Generation

Most web-based document tools generate PDFs by taking a DOM screenshot (HTML-to-Canvas to PNG) and wrapping it in a PDF container.

This approach fails for professional print and design workflows because:

  • Text becomes rasterized instead of remaining selectable vector typography.
  • Vector graphics lose sharp scaling and print clarity.
  • Color spaces shift because web canvases only render in RGB.

Tech Architecture & Solutions

To deliver crisp vector brand books, the app separates the real-time preview from the vector compilation pipeline:

  • Framework: Next.js (App Router)
  • Live UI Engine: React + Tailwind CSS with CSS Variables for instant live previews.
  • Vector PDF Compiler: Dynamic SVG-to-PDF coordinate mapping using client-side PDF stream rendering.

How Dynamic Color Token Conversion Works

A key feature of automated brand books is generating multi-format color tokens (Hex, RGB, CMYK, HSL) from a single color picker input.

Here is a simplified snippet of how the color token engine processes user inputs for both screen and commercial print specifications:


javascript
// Color conversion helper for brand spec tables
function generateBrandColorTokens(hexColor) {
  // Strip hash and convert to RGB
  const hex = hexColor.replace('#', '');
  const r = parseInt(hex.substring(0, 2), 16) / 255;
  const g = parseInt(hex.substring(2, 4), 16) / 255;
  const b = parseInt(hex.substring(4, 6), 16) / 255;

  // Calculate CMYK values for print specs
  const k = 1 - Math.max(r, g, b);
  const c = k === 1 ? 0 : Math.round(((1 - r - k) / (1 - k)) * 100);
  const m = k === 1 ? 0 : Math.round(((1 - g - k) / (1 - k)) * 100);
  const y = k === 1 ? 0 : Math.round(((1 - b - k) / (1 - k)) * 100);

  return {
    hex: `#${hex.toUpperCase()}`,
    rgb: `rgb(${Math.round(r * 255)}, ${Math.round(g * 255)}, ${Math.round(b * 255)})`,
    cmyk: `C:${c}% M:${m}% Y:${y}% K:${Math.round(k * 100)}%`
  };
}
Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
jeffrey_desenfans_967111e profile image
Jeffrey Desenfans

Key Developer Takeaways

Keep Vectors Native: Generating true vector stream paths in PDFs ensures logos and typography remain pin-sharp at any zoom level or print resolution.

Instant UI Feedback Loops: Using reactive CSS variables for the live preview gives users instant feedback before clicking "Export PDF".
Enter fullscreen mode Exit fullscreen mode

Check out the project live at BrandGuideMaker.

How do you handle dynamic document or design system generation in your stack? Let's chat in the comments!

Some comments may only be visible to logged-in visitors. Sign in to view all comments.