Here's a thinking process that leads to the suggested CLI tool:
-
Analyze the Request:
-
Goal: Design a white-label theming CLI.
-
Core Functions: Generate brand manifests, calculate token diffs, generate integration tests for customer onboarding.
-
Role: Top-tier creative frontend engineer/UI UX designer (10yr exp, Awwwards winner).
-
Design Principles: Deep typography, negative space, color psychology (60-30-10), Swiss/Minimalist style.
-
Imagination Triggers: Micro-interactions (magnetic buttons), nonlinear layout (though CLI is terminal-based, we can simulate a rich UI/UX in a web wrapper or just make the concept design for the CLI's internal branding/tokens), narrative scrolling (maybe for the manual/docs).
-
Tech Stack: Tailwind (for web views), GSAP/Three.js (if we have a graphical component).
-
Constraint: A single self-contained HTML file.
-
Interpretation for a "Single HTML File" Output:
- Real CLIs run in the terminal. I cannot make a real executable CLI in an HTML file.
- However, the user asked to "Design a white-label theming CLI...". Usually, this implies designing the interface/dashboard or a simulation of the tool, or perhaps a documentation page that demonstrates the tool's capabilities.
- Strategy: I will build a high-fidelity Interactive Simulation / Marketing Page for this CLI tool. It will feature an interactive "Terminal/Code" window where the user can "run" the commands to see how it works, showcasing the generated manifests, token diffs, and tests. I'll also incorporate high-end design elements (Swiss typography, 3D background, GSAP animations) to meet the aesthetic requirements.
-
Conceptualization:
- Title: "Chroma" or "Polaris" (White-label theming engine). Let's go with "Spectrum CLI".
- Theme: Dark mode base (Swiss minimalism) with vibrant accents (Cyber Blue / Sunset Glow).
- Structure:
- Hero Section: Big bold typography, high contrast, 3D abstract background (Three.js particles or shader).
- Interactive Demo: A terminal window where the user can click buttons to trigger commands (
spectrum init, spectrum diff, spectrum test). This simulates the real workflow.
- Feature Grid: Explaining the tech (Manifests, Token Diffs, Integration Tests).
- Manifest Preview: A dynamic JSON table or Form showing the generated brand manifest.
- Diff Viewer: Visual representation of color changes (before/after).
- Test Output: Pass/Fail console logs.
-
Technical Implementation Steps:
- HTML Structure: Semantic tags (
header, main, section, div for terminal).
- Styling (Tailwind): Use CDN. Configure custom fonts (Inter, Playfair Display). Custom colors in Tailwind config within the
<script> tag.
- 3D Background: Three.js scene. A floating, rotating mesh with wireframe or particles to give a "digital space" feeling. Needs to be interactive (responds to mouse).
- Terminal Logic (JavaScript):
- Array of commands.
type effect for output.
- Tab switching (Manifest view, Diff view, Test view).
- GSAP: Use for scroll animations (text reveal) and terminal window interactions.
-
Drafting the Design:
- Color Palette:
- Background: Hex
#050505 (Deep void).
- Primary Text: White/Grey.
- Accent: Electric Blue (
#00f0ff) and Purple (#7000ff) gradients.
- Typography:
Inter for body, Playfair Display for headers.
-
Developing the Components:
-
Refining the "White-label" Aspect:
- The tool generates brand manifests. I need to show an example of a JSON object representing a custom brand (e.g., "Nike" or "Generic Enterprise"). I'll generate a cool-looking JSON block with syntax highlighting.
-
Step-by-Step Coding (Mental Draft):
- Setup: HTML5 boilerplate, Tailwind CDN, Three.js CDN, GSAP CDN.
- Styles: Custom scrollbar, selection color, font overrides.
- Three.js Script: Create the background. Ensure it runs full screen fixed behind content.
- Main Script:
- Terminal logic:
async function print(text).
- Command mapping:
commands['init'] = runInit.
- Button listeners to call commands.
- GSAP init.
-
Detailed Logic for Terminal Simulation:
- Start with
Welcome to Spectrum CLI v1.0.0.
- Provide a UI: "Try it out" buttons next to the prompt.
- Button 1:
spectrum generate manifest <brand> -> Display JSON.
- Button 2:
spectrum diff <source> <target> -> Display color diff.
- Button 3:
spectrum test coverage -> Display test results.
- JSON Structure:
{
"brand": "Acme Corp",
"tokens": {
"color": { "primary": "#FF0000", "secondary": "#00FF00" },
"typography": { "fontFamily": "Inter" }
}
}
- Diff Format: HTML table rows with red/green backgrounds.
- Test Format:
[PASS] Check color palette consistency.
-
Polishing:
- Noise Texture: Use a base64 tiny noise image or CSS radial gradient trick for subtle grain over the whole page to give it texture.
- Glassmorphism: The terminal window should have
backdrop-filter: blur(10px) and semi-transparent border.
- Accessibility: High contrast text, readable fonts.
-
Final Review against Requirements:
- White-label theming CLI? Yes, simulated.
- Brand manifests? Shown in JSON.
- Token diffs? Shown in table.
- Integration tests? Shown in logs.
- Onboarding context? UI suggests it's a tool for customers.
- Single HTML? Yes.
- Visuals: Swiss, minimalist, dark mode, interactive 3D background, GSAP animations.
- No alerts: Using DOM manipulation for feedback.
- Language: English (as requested).
-
Writing the Code: (Self-correction during coding)
- Issue: Three.js might be heavy. Keep geometry simple (Icosahedron).
- Issue: Text contrast. Ensure dark background text is white/light gray.
- Refinement: The "Terminal" shouldn't look like a generic OS terminal. It should look like a "playground".
- Micro-interaction: When clicking a command button, the button itself should have a "press" animation.
-
Final Output Generation: (Produces the HTML structure below).
Here is a complete, single-file HTML solution that simulates the "Spectrum CLI" – a white-label theming engine for brand manifests, token diffs, and integration testing.
This page combines high-end Swiss-style design with a fully interactive terminal simulation, 3D ambient background (Three.js), and GSAP scroll animations.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Spectrum CLI | White-label Theming Engine</title>
<!-- Fonts: Inter (Body) & Playfair Display (Headers) -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Playfair+Display:ital,wght@0,600;0,700;1,600&display=swap" rel="stylesheet">
<!-- Tailwind CSS (Custom Config) -->
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
void: '#050505',
surface: '#121212',
'surface-high': '#1E1E1E',
accent: '#00f0ff',
'accent-dim': 'rgba(0, 240, 255, 0.1)',
success: '#00ff9d',
error: '#ff4d4d',
},
fontFamily: {
sans: ['Inter', 'sans-serif'],
serif: ['Playfair Display', 'serif'],
},
boxShadow: {
'glow': '0 0 20px rgba(0, 240, 255, 0.3)',
'inner-glow': 'inset 0 0 20px rgba(0, 240, 255, 0.05)',
}
}
}
}
</script>
<!-- Styles for specific layout overrides -->
<style>
body {
background-color: #050505;
color: #ffffff;
overflow-x: hidden;
-webkit-font-smoothing: antialiased;
}
/* Grain Texture Overlay */
.grain::before {
content: "";
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.05'/%3E%3C/svg%3E");
pointer-events: none;
z-index: 9999;
mix-blend-mode: overlay;
}
/* Terminal Styles */
.terminal-window {
background: rgba(30, 30, 30, 0.6);
backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.05);
border-radius: 12px;
overflow: hidden;
font-family: 'Courier New', Courier, monospace; /* Fallback */
}
.terminal-header {
background: rgba(0,0,0,0.3);
border-bottom: 1px solid rgba(255,255,255,0.05);
padding: 0.75rem 1rem;
display: flex;
align-items: center;
justify-content: space-between;
}
.terminal-body {
padding: 1.5rem;
min-height: 400px;
font-size: 0.9rem;
line-height: 1.6;
color: #e0e0e0;
}
.prompt-line {
display: flex;
align-items: center;
margin-bottom: 1rem;
}
.prompt-user {
color: #00f0ff;
margin-right: 0.5rem;
font-weight: bold;
}
.prompt-path {
color: #ffcc00;
margin-right: 0.5rem;
}
.typing-cursor::after {
content: "_";
animation: blink 1s step-start infinite;
}
@keyframes blink {
50% { opacity: 0; }
}
/* JSON Syntax Highlighting */
.json-key { color: #9cdcfe; }
.json-string { color: #ce9178; }
.json-number { color: #b5cea8; }
.json-boolean { color: #569cd6; }
/* Custom Scrollbar */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #050505;
}
::-webkit-scrollbar-thumb {
background: #333;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #555;
}
/* Magnetic Button Effect Base */
.magnetic-btn {
transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.magnetic-btn:active {
transform: scale(0.95);
}
/* Selection */
::selection {
background: rgba(0, 240, 255, 0.3);
}
</style>
</head>
<body class="grain">
<!-- Three.js Background Container -->
<div id="canvas-container" class="fixed inset-0 z-0 pointer-events-none opacity-40"></div>
<!-- Navigation -->
<nav class="fixed top-0 w-full z-50 py-6 px-8 flex justify-between items-center mix-blend-difference text-white">
<div class="text-xl font-serif font-bold tracking-widest">SPECTRUM CLI</div>
<div class="hidden md:flex space-x-8 text-sm font-light tracking-wide">
<a href="#features" class="hover:text-accent transition-colors">Features</a>
<a href="#demo" class="hover:text-accent transition-colors">Interactive Demo</a>
<a href="#" class="border border-white/20 px-4 py-1 rounded-full hover:bg-white hover:text-black transition-all">Install</a>
</div>
</nav>
<!-- Main Content -->
<main class="relative z-10 pt-32 pb-24 px-6 md:px-20 max-w-7xl mx-auto">
<!-- Section: Hero -->
<section class="mb-32 text-center max-w-4xl mx-auto">
<p class="text-accent font-mono text-xs mb-6 tracking-[0.2em] uppercase gs-reveal">Version 2.0.4 • Build 8902</p>
<h1 class="text-5xl md:text-7xl font-serif font-bold mb-8 leading-tight gs-reveal">
White-label Theming<br>for the Modern Web
</h1>
<p class="text-gray-400 text-lg md:text-xl font-light max-w-2xl mx-auto mb-12 leading-relaxed gs-reveal">
Generate brand manifests, compute precise token diffs, and run integration tests
automatically. Onboard customers faster than ever before.
</p>
<div class="flex flex-col md:flex-row gap-4 justify-center items-center gs-reveal">
<button class="magnetic-btn bg-white text-black px-8 py-4 rounded-full font-medium text-sm tracking-wide hover:bg-accent hover:text-black hover:shadow-glow transition-all">
Read Documentation
</button>
<button class="magnetic-btn border border-white/20 text-white px-8 py-4 rounded-full font-medium text-sm tracking-wide hover:border-accent hover:text-accent transition-all">
GitHub Repository
</button>
</div>
</section>
<!-- Section: Interactive Terminal (Core Feature) -->
<section id="demo" class="mb-32 scroll-mt-32">
<div class="mb-8 flex justify-between items-end gs-reveal">
<div>
<h2 class="text-3xl font-serif font-bold mb-2">Playground</h2>
<p class="text-gray-400 text-sm">Simulate the CLI workflow to see the generated output.</p>
</div>
<!-- Command Triggers -->
<div class="flex gap-4">
<button onclick="runCommand('init')" class="magnetic-btn bg-[#1E1E1E] border border-white/10 hover:border-accent text-xs font-mono px-4 py-2 rounded text-gray-300 hover:text-white transition-all">
spectrum generate manifest
</button>
<button onclick="runCommand('diff')" class="magnetic-btn bg-[#1E1E1E] border border-white/10 hover:border-accent text-xs font-mono px-4 py-2 rounded text-gray-300 hover:text-white transition-all">
spectrum token diff --all
</button>
<button onclick="runCommand('test')" class="magnetic-btn bg-[#1E1E1E] border border-white/10 hover:border-accent text-xs font-mono px-4 py-2 rounded text-gray-300 hover:text-white transition-all">
spectrum test integration
</button>
</div>
</div>
<div class="terminal-window relative group gs-scale">
<!-- Window Controls -->
<div class="terminal-header flex items-center">
<div class="flex space-x-2">
<div class="w-3 h-3 rounded-full bg-error"></div>
<div class="w-3 h-3 rounded-full bg-yellow-500"></div>
<div class="w-3 h-3 rounded-full bg-accent"></div>
</div>
<div class="text-xs text-gray-500 font-mono">spectrum-cli — bash</div>
<div class="text-xs text-gray-500"></div>
</div>
<!-- Terminal Body -->
<div id="terminal-output" class="terminal-body font-mono text-sm overflow-y-auto max-h-[500px]">
<!-- Initial Content -->
<div class="mb-4 text-gray-500">Last login: <span id="current-date"></span> on ttys001</div>
<div class="mb-2">Welcome to <span class="text-accent">Spectrum CLI</span> v1.0.0</div>
<div class="mb-6 text-gray-400 text-xs">Use the buttons above to run demonstration commands.</div>
<div id="prompt-area" class="typing-cursor text-white">
<span class="prompt-user">user</span>
<span>@</span>
<span class="prompt-path">spectrum</span>
<span>:~$</span>
<span class="prompt-input ml-2">_</span>
</div>
</div>
<!-- Floating Active Tab Indicator -->
<div id="tab-indicator" class="absolute top-16 left-4 text-[10px] uppercase tracking-widest text-accent border-l-2 border-accent pl-2 opacity-0 transition-opacity">
</div>
</div>
</section>
<!-- Section: Bento Grid of Features (Visual Flair) -->
<section id="features" class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-32">
<div class="bg-surface border border-white/5 p-8 rounded-2xl gs-stagger hover:border-accent/30 transition-colors duration-500">
<div class="w-12 h-12 rounded-full bg-accent/10 flex items-center justify-center mb-6 text-accent">
<svg width="24" height="24" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><path d="M14 2v6h6"></path><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>
</div>
<h3 class="text-xl font-serif font-bold mb-3">Brand Manifests</h3>
<p class="text-gray-400 text-sm leading-relaxed">
Automatically generate standardized JSON manifests for every customer brand. Define colors, typography, and spacing tokens in a single source of truth.
</p>
</div>
<div class="bg-surface border border-white/5 p-8 rounded-2xl gs-stagger hover:border-accent/30 transition-colors duration-500">
<div class="w-12 h-12 rounded-full bg-accent/10 flex items-center justify-center mb-6 text-accent">
<svg width="24" height="24" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><polyline points="16 3 21 3 21 8"></polyline><line x1="4" y1="20" x2="21" y2="3"></line><polyline points="21 16 21 21 16 21"></polyline><line x1="15" y1="15" x2="21" y2="21"></line><line x1="4" y1="4" x2="9" y2="9"></line></svg>
</div>
<h3 class="text-xl font-serif font-bold mb-3">Token Diffs</h3>
<p class="text-gray-400 text-sm leading-relaxed">
Visually compare token sets across brand versions. Highlight semantic changes and ensure consistency before deploying updates.
</p>
</div>
<div class="bg-surface border border-white/5 p-8 rounded-2xl gs-stagger hover:border-accent/30 transition-colors duration-500">
<div class="w-12 h-12 rounded-full bg-accent/10 flex items-center justify-center mb-6 text-accent">
<svg width="24" height="24" fill="none" stroke="currentColor" stroke-width="2" viewBox="0 0 24 24"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg>
</div>
<h3 class="text-xl font-serif font-bold mb-3">Integration Tests</h3>
<p class="text-gray-400 text-sm leading-relaxed">
Generate and run automated tests against your token implementations. Ensure CSS, JS, and native mobile updates align with the manifest 100% of the time.
</p>
</div>
</section>
<!-- Footer -->
<footer class="pt-12 border-t border-white/10 text-center text-gray-500 text-sm">
<p>© 2023 Spectrum CLI. Design for Developers.</p>
</footer>
</main>
<!-- Scripts -->
<!-- Three.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<!-- GSAP -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/ScrollTrigger.min.js"></script>
<script>
/* --------------------------------------------------------------
1. CONFIGURATION & STATE
-------------------------------------------------------------- */
const terminalOutput = document.getElementById('terminal-output');
const promptArea = document.getElementById('prompt-area');
const tabIndicator = document.getElementById('tab-indicator');
// Mock Data for simulation
const brandManifest = {
"brand": "Acme Corp",
"version": "1.0.2",
"tokens": {
"color": {
"primary": {
"value": "#FF3B30",
"type": "color"
},
"secondary": {
"value": "#007AFF",
"type": "color"
},
"background": {
"value": "#F2F2F7",
"type": "color"
},
"text": {
"value": "#1C1C1E",
"type": "color"
}
},
"font": {
"family": {
"value": "Inter",
"type": "fontFamily"
},
"size": {
"base": {
"value": "16px",
"type": "dimension"
}
}
}
}
};
const diffResult = [
{ path: "$.color.primary.value", old: "#FF3B30", new: "#FF9500", status: "CHANGED" },
{ path: "$.color.secondary.value", old: "#007AFF", new: "#5856D6", status: "CHANGED" },
{ path: "$.font.family.value", old: "Inter", new: "Inter", status: "IDENTICAL" },
{ path: "$.token.rounded", old: "8px", new: "12px", status: "NEW" }
];
const testResults = [
{ name: "Palette Completeness", status: "PASS", message: "All semantic colors present." },
{ name: "Contrast Ratio AA", status: "PASS", message: "Text/Background ratios compliant." },
{ name: "Spacing Scale Sync", status: "FAIL", message: "Scale mismatch in module.css:28" },
{ name: "Typography Alias", status: "PASS", message: "Font weights mapped correctly." },
{ name: "iOS Native Bridge", status: "PASS", message: "RBColorSpace resolved." }
];
/* --------------------------------------------------------------
2. TERMINAL LOGIC
-------------------------------------------------------------- */
async function typeWriter(text, element, speed = 10, className = '') {
const p = document.createElement('div');
if(className) p.className = className;
element.appendChild(p);
for (let i = 0; i < text.length; i++) {
p.textContent += text.charAt(i);
// Randomize slightly for realism
await new Promise(r => setTimeout(r, speed + Math.random() * 20));
}
}
async function printLine(text, className = '', speed = 10) {
await typeWriter(text, terminalOutput, speed, className);
}
async function printJSON(obj) {
const pre = document.createElement('pre');
pre.className = 'json mt-2 mb-4 text-xs overflow-x-auto';
pre.style.whiteSpace = 'pre-wrap';
terminalOutput.appendChild(pre);
function traverse(obj, indent = 0) {
const spacing = ' '.repeat(indent);
if (typeof obj === 'object' && obj !== null) {
for (let key in obj) {
const isLast = Object.keys(obj).indexOf(key) === Object.keys(obj).length - 1;
const lineBreak = isLast ? '' : '\n';
const keySpan = document.createElement('span');
keySpan.innerHTML = `${spacing}<span class="json-key">"${key}"</span>: `;
pre.appendChild(keySpan);
if (typeof obj[key] === 'object') {
pre.appendChild(document.createTextNode('{\n'));
traverse(obj[key], indent + 1);
const close = document.createElement('span');
close.innerHTML = `${spacing}}}${lineBreak}`;
pre.appendChild(close);
} else {
let valSpan;
if (typeof obj[key] === 'string') {
valSpan = document.createElement('span');
valSpan.className = 'json-string';
valSpan.textContent = `"${obj[key]}"`;
} else if (typeof obj[key] === 'number') {
valSpan = document.createElement('span');
valSpan.className = 'json-number';
valSpan.textContent = obj[key];
} else if (typeof obj[key] === 'boolean') {
valSpan = document.createElement('span');
valSpan.className = 'json-boolean';
valSpan.textContent = obj[key];
}
pre.appendChild(valSpan);
const comma = !isLast ? ',' : '';
const commaNode = document.createTextNode(comma + lineBreak);
pre.appendChild(commaNode);
}
}
}
}
traverse(obj);
}
async function printTable(data) {
const table = document.createElement('div');
table.className = 'overflow-x-auto mt-2 mb-4';
let html = `<table class="w-full text-xs text-left border-collapse"><thead><tr class="border-b border-white/10 text-gray-400">
<th class="py-2 px-1">Path</th>
<th class="py-2 px-1">Old Value</th>
<th class="py-2 px-1">New Value</th>
<th class="py-2 px-1">Status</th>
</tr></thead><tbody>`;
data.forEach(row => {
const oldColor = row.status === 'IDENTICAL' ? 'text-gray-400' : 'text-red-400';
const newColor = row.status === 'NEW' ? 'text-accent' : 'text-green-400'; // using accent for new, green for changed/tbd
const statusColor = row.status === 'PASS' || row.status === 'IDENTICAL' ? 'text-gray-500' : (row.status === 'NEW' ? 'text-accent' : 'text-yellow-500');
html += `
<tr class="border-b border-white/5 hover:bg-white/5">
<td class="py-2 px-1 font-mono text-gray-300">${row.path}</td>
<td class="py-2 px-1 font-mono ${oldColor}">${row.old}</td>
<td class="py-2 px-1 font-mono ${newColor}">${row.new}</td>
<td class="py-2 px-1 font-mono uppercase text-xs ${statusColor}">${row.status}</td>
</tr>
`;
});
html += '</tbody></table>';
table.innerHTML = html;
terminalOutput.appendChild(table);
}
async function printTestResults(data) {
const list = document.createElement('div');
list.className = 'flex flex-col gap-2 mt-2 mb-4';
data.forEach(test => {
const isPass = test.status === 'PASS';
const icon = isPass ? '✓' : '✗';
const colorClass = isPass ? 'text-success' : 'text-error';
const line = document.createElement('div');
line.className = 'flex items-start gap-3 text-xs';
line.innerHTML = `
<span class="${colorClass} font-bold mt-0.5">${icon}</span>
<div class="flex flex-col">
<span class="text-white font-medium">${test.name}</span>
<span class="text-gray-500">${test.message}</span>
</div>
`;
list.appendChild(line);
});
terminalOutput.appendChild(list);
}
async function simulateCommand(commandName, action) {
// Remove cursor
const cursorSpan = promptArea.querySelector('.prompt-input');
if(cursorSpan) cursorSpan.style.display = 'none';
// Indicate running
tabIndicator.textContent = commandName;
tabIndicator.style.opacity = '1';
await printLine(`Running ${commandName}...`, 'text-accent', 5);
// Scroll to bottom
terminalOutput.scrollTop = terminalOutput.scrollHeight;
await new Promise(r => setTimeout(r, 800));
// Remove indicator line
const indicatorLine = terminalOutput.lastElementChild.previousElementSibling;
if(indicatorLine && indicatorLine.classList.contains('text-accent')) {
indicatorLine.remove();
}
// Execute specific logic
await action();
// Re-add prompt
promptArea.style.display = 'flex';
terminalOutput.scrollTop = terminalOutput.scrollHeight;
tabIndicator.style.opacity = '0';
}
/* --------------------------------------------------------------
3. COMMAND HANDLERS
-------------------------------------------------------------- */
async function runCommand(type) {
if (isAnimating) return;
isAnimating = true;
// 1. Clear previous output (except login and initial messages)
// In a real terminal we append, but for demo we might want to reset or allow stacking.
// Let's append-on for a real feel, but identify "sections".
if (type === 'init') {
// Add visual separator
await printLine(`$ spectrum generate manifest AcmeCorp`, 'text-gray-500 font-bold my-4', 0);
await printLine(`Analyzing design system...`, 'text-gray-400', 20);
await printLine(`Parsing Figma tokens...`, 'text-gray-400', 20);
await printLine(`Generating manifest: <span class="text-accent">brand.manifest.json</span>`);
await printJSON(brandManifest);
await printLine(`Manifest generated successfully.`);
} else if (type === 'diff') {
await printLine(`$ spectrum token diff AcmeCorp_v1.0.1 AcmeCorp_v1.0.2`, 'text-gray-500 font-bold my-4', 0);
await printLine(`Comparing token sets...`, 'text-gray-400', 20);
await printLine(`Found <span class="text-accent">3</span> differences.`, '', 20);
await printTable(diffResult);
} else if (type === 'test') {
await printLine(`$ spectrum test integration --coverage`, 'text-gray-500 font-bold my-4', 0);
await printLine(`Initializing test environment...`, 'text-gray-400', 20);
await printLine(`Loading <span class="text-accent">5</span> test suites...`, '', 20);
await printLine(`Running tests...`, '', 10);
// Simulate delay with fun logs
await printLine(`[RUN] 1/5 Palette Completeness...`, 'text-gray-400', 10);
await printLine(`[RUN] 2/5 Contrast Ratio AA...`, 'text-gray-400', 10);
await printLine(`[RUN] 3/5 Spacing Scale Sync...`, 'text-gray-400', 10);
await printLine(`[RUN] 4/5 Typography Alias...`, 'text-gray-400', 10);
await printLine(`[RUN] 5/5 iOS Native Bridge...`, 'text-gray-400', 10);
await printTestResults(testResults);
const passCount = testResults.filter(t => t.status === 'PASS').length;
const totalCount = testResults.length;
await printLine(`Results: <span class="text-success">${passCount} passed</span> / ${totalCount} total.`, 'text-white', 20);
}
isAnimating = false;
}
let isAnimating = false;
/* --------------------------------------------------------------
4. THREE.JS BACKGROUND
-------------------------------------------------------------- */
function initThree() {
const container = document.getElementById('canvas-container');
const scene = new THREE.Scene();
// Fog for depth
scene.fog = new THREE.FogExp2(0x050505, 0.002);
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
camera.position.z = 30;
const renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
container.appendChild(renderer.domElement);
// Geom: Complex Icosahedron Wireframe
const geometry = new THREE.IcosahedronGeometry(10, 2);
const wireframe = new THREE.WireframeGeometry(geometry);
// Material: Glowing line
const material = new THREE.LineBasicMaterial({
color: 0x00f0ff,
transparent: true,
opacity: 0.15,
linewidth: 1
});
const sphere = new THREE.LineSegments(wireframe, material);
scene.add(sphere);
// Inner Core
const coreGeo = new THREE.IcosahedronGeometry(4, 1);
const coreMat = new THREE.MeshBasicMaterial({
color: 0x7000ff,
wireframe: true,
transparent: true,
opacity: 0.1
});
const core = new THREE.Mesh(coreGeo, coreMat);
scene.add(core);
// Particles
const particlesGeo = new THREE.BufferGeometry();
const particleCount = 400;
const posArray = new Float32Array(particleCount * 3);
for(let i = 0; i < particleCount * 3; i++) {
posArray[i] = (Math.random() - 0.5) * 80;
}
particlesGeo.setAttribute('position', new THREE.BufferAttribute(posArray, 3));
const particlesMat = new THREE.PointsMaterial({
size: 0.15,
color: 0xffffff,
transparent: true,
opacity: 0.5
});
const particlesMesh = new THREE.Points(particlesGeo, particlesMat);
scene.add(particlesMesh);
// Lights
const ambientLight = new THREE.AmbientLight(0xffffff, 0.5);
scene.add(ambientLight);
const pointLight = new THREE.PointLight(0x00f0ff, 1, 100);
pointLight.position.set(10, 10, 10);
scene.add(pointLight);
// Interaction Variables
let mouseX = 0;
let mouseY = 0;
let targetX = 0;
let targetY = 0;
// Event Listeners
document.addEventListener('mousemove', (event) => {
mouseX = (event.clientX - window.innerWidth / 2) * 0.001;
mouseY = (event.clientY - window.innerHeight / 2) * 0.001;
});
window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
// Animation Loop
const clock = new THREE.Clock();
function animate() {
requestAnimationFrame(animate);
const elapsedTime = clock.getElapsedTime();
targetX = mouseX * 0.5;
targetY = mouseY * 0.5;
// Smooth rotation
sphere.rotation.y += 0.002;
sphere.rotation.x += 0.001;
sphere.rotation.y += 0.05 * (targetX - sphere.rotation.y);
sphere.rotation.x += 0.05 * (targetY - sphere.rotation.x);
// Bobbing
sphere.position.y = Math.sin(elapsedTime * 0.5) * 1;
// Core rotation
core.rotation.y -= 0.005;
core.rotation.x -= 0.005;
// Particles subtle movement
particlesMesh.rotation.y = elapsedTime * 0.05;
particlesMesh.rotation.x = mouseX * 0.1;
renderer.render(scene, camera);
}
animate();
}
/* --------------------------------------------------------------
5. GSAP ANIMATIONS & INIT
-------------------------------------------------------------- */
function initGSAP() {
gsap.registerPlugin(ScrollTrigger);
// Stagger Hero reveal
gsap.from('.gs-reveal', {
y: 50,
opacity: 0,
duration: 1,
stagger: 0.2,
ease: 'power3.out'
});
// Scale up terminal on scroll
gsap.from('.gs-scale', {
scrollTrigger: {
trigger: '#demo',
start: 'top 80%',
},
scale: 0.95,
opacity: 0,
duration: 1,
ease: 'back.out(1.7)'
});
// Stagger Feature cards
gsap.from('.gs-stagger', {
scrollTrigger: {
trigger: '#features',
start: 'top 80%',
},
y: 30,
opacity: 0,
duration: 0.8,
stagger: 0.15,
ease: 'power2.out'
});
}
/* --------------------------------------------------------------
6. UTILITIES & BOOTSTRAP
-------------------------------------------------------------- */
function setDate() {
const now = new Date();
const options = { weekday: 'short', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' };
document.getElementById('current-date').textContent = now.toLocaleDateString('en-US', options) + ' ' + now.toLocaleTimeString('en-US', {hour: '2-digit', minute:'2-digit'});
}
// Bootstrap
window.onload = () => {
initThree();
initGSAP();
setDate();
};
</script>
</body>
</html>