File size: 32,389 Bytes
e28a3cf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Infinite Universe Explorer</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
@keyframes float {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-20px); }
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
@keyframes pulse {
0%, 100% { transform: scale(1); }
50% { transform: scale(1.05); }
}
.floating {
animation: float 6s ease-in-out infinite;
}
.spinning {
animation: spin 20s linear infinite;
}
.pulsing {
animation: pulse 3s ease infinite;
}
.theme-transition {
transition: all 0.5s ease;
}
.particle {
position: absolute;
background: currentColor;
border-radius: 50%;
pointer-events: none;
}
.gradient-mask {
mask-image: linear-gradient(to right, transparent 0%, black 20%, black 80%, transparent 100%);
}
.code-container {
max-height: 0;
overflow: hidden;
transition: max-height 0.5s ease;
}
.code-container.open {
max-height: 500px;
}
.copy-btn {
transition: all 0.2s ease;
}
.copy-btn.copied {
background-color: #10B981 !important;
}
</style>
</head>
<body class="min-h-screen bg-gradient-to-br from-indigo-900 to-purple-800 text-white theme-transition">
<div id="particles-container" class="fixed inset-0 overflow-hidden pointer-events-none"></div>
<div class="container mx-auto px-4 py-12">
<header class="text-center mb-16">
<div class="floating inline-block mb-6">
<div class="spinning text-6xl mb-2">
<i class="fas fa-infinity"></i>
</div>
</div>
<h1 class="text-5xl font-bold mb-4 tracking-tighter bg-clip-text text-transparent bg-gradient-to-r from-amber-300 to-pink-400">
Infinite Universe Explorer
</h1>
<p class="text-xl opacity-80 max-w-2xl mx-auto">
Discover truly infinite random themes with unique colors and patterns!
</p>
</header>
<main class="max-w-4xl mx-auto">
<div class="bg-white/10 backdrop-blur-lg rounded-3xl overflow-hidden border border-white/20 mb-12">
<div class="p-8 md:p-12">
<div class="flex flex-col md:flex-row gap-8 items-center">
<div class="flex-1">
<h2 class="text-3xl font-bold mb-4">Current Dimension</h2>
<div id="theme-display" class="mb-6 p-6 rounded-xl bg-black/20 border border-white/10">
<div class="flex items-center gap-3 mb-4">
<span id="theme-icon" class="text-3xl"><i class="fas fa-question"></i></span>
<span id="theme-name" class="text-2xl font-medium">Unknown Dimension</span>
</div>
<p id="theme-description" class="opacity-80">
Waiting to discover your first random dimension...
</p>
</div>
<div class="grid grid-cols-5 gap-2 mb-4">
<div id="color1" class="h-12 rounded-md relative group">
<div class="hex-tooltip absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 bg-black/90 text-white text-xs px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none whitespace-nowrap"></div>
</div>
<div id="color2" class="h-12 rounded-md relative group">
<div class="hex-tooltip absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 bg-black/90 text-white text-xs px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none whitespace-nowrap"></div>
</div>
<div id="color3" class="h-12 rounded-md relative group">
<div class="hex-tooltip absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 bg-black/90 text-white text-xs px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none whitespace-nowrap"></div>
</div>
<div id="color4" class="h-12 rounded-md relative group">
<div class="hex-tooltip absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 bg-black/90 text-white text-xs px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none whitespace-nowrap"></div>
</div>
<div id="color5" class="h-12 rounded-md relative group">
<div class="hex-tooltip absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 bg-black/90 text-white text-xs px-2 py-1 rounded opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none whitespace-nowrap"></div>
</div>
</div>
<div class="flex justify-between items-center mb-6">
<div id="hex-codes" class="text-sm opacity-80 flex gap-2 flex-wrap">
<!-- Hex codes will be displayed here -->
</div>
<button id="copy-hex-btn" class="copy-btn text-xs bg-white/10 hover:bg-white/20 px-3 py-1 rounded-full flex items-center gap-1">
<i class="fas fa-copy"></i> Copy
</button>
</div>
<button id="generate-btn" class="pulsing w-full py-4 px-6 bg-gradient-to-r from-amber-400 to-pink-500 rounded-xl font-bold text-lg hover:opacity-90 transition-all duration-300 shadow-lg hover:shadow-xl active:scale-95 mb-4">
<i class="fas fa-random mr-2"></i> Explore New Dimension
</button>
<button id="toggle-css-btn" class="w-full py-3 px-6 bg-white/5 hover:bg-white/10 rounded-xl font-medium transition-all duration-300 flex items-center justify-center gap-2">
<i class="fas fa-code"></i> Generate CSS Code
</button>
</div>
<div class="flex-1">
<div class="relative h-64 md:h-80 rounded-2xl overflow-hidden border-2 border-white/20">
<div id="pattern-display" class="absolute inset-0 flex items-center justify-center">
<div class="text-6xl opacity-20"><i class="fas fa-star"></i></div>
</div>
</div>
</div>
</div>
<!-- CSS Code Container -->
<div id="css-code-container" class="code-container mt-6 bg-black/30 rounded-xl overflow-hidden">
<div class="p-4 border-t border-white/10 flex justify-between items-center">
<h3 class="font-mono font-bold text-sm">CSS Variables</h3>
<button id="copy-css-btn" class="copy-btn text-xs bg-white/10 hover:bg-white/20 px-3 py-1 rounded-full flex items-center gap-1">
<i class="fas fa-copy"></i> Copy
</button>
</div>
<pre id="css-code" class="p-4 text-sm font-mono overflow-auto max-h-64 bg-black/20"></pre>
</div>
</div>
</div>
<div class="grid md:grid-cols-3 gap-6 mb-12">
<div class="bg-white/5 backdrop-blur-sm p-6 rounded-2xl border border-white/10 hover:bg-white/10 transition-all">
<div class="text-3xl mb-4 text-amber-300"><i class="fas fa-infinity"></i></div>
<h3 class="text-xl font-bold mb-2">Infinite Variety</h3>
<p class="opacity-80">Every dimension is completely unique with randomly generated colors and patterns.</p>
</div>
<div class="bg-white/5 backdrop-blur-sm p-6 rounded-2xl border border-white/10 hover:bg-white/10 transition-all">
<div class="text-3xl mb-4 text-pink-400"><i class="fas fa-atom"></i></div>
<h3 class="text-xl font-bold mb-2">Quantum Colors</h3>
<p class="opacity-80">Colors are generated using quantum-inspired algorithms for maximum uniqueness.</p>
</div>
<div class="bg-white/5 backdrop-blur-sm p-6 rounded-2xl border border-white/10 hover:bg-white/10 transition-all">
<div class="text-3xl mb-4 text-purple-300"><i class="fas fa-shapes"></i></div>
<h3 class="text-xl font-bold mb-2">Dynamic Patterns</h3>
<p class="opacity-80">Patterns are procedurally generated to match each dimension's unique properties.</p>
</div>
</div>
<div class="bg-white/5 backdrop-blur-sm p-6 rounded-2xl border border-white/10 mb-12">
<h2 class="text-2xl font-bold mb-4">Dimension History</h2>
<div id="history-container" class="flex overflow-x-auto pb-4 gap-4 gradient-mask">
<!-- History items will be added here -->
</div>
</div>
</main>
<footer class="text-center opacity-70 mt-20 pb-8">
<p>Journey through the infinite multiverse <i class="fas fa-infinity text-purple-300"></i></p>
</footer>
</div>
<script>
// Word banks for generating random theme names and descriptions
const prefixes = ["Quantum", "Neon", "Cosmic", "Hyper", "Digital", "Fractal", "Ethereal", "Void", "Celestial", "Nebula", "Chromatic", "Prismatic", "Luminous", "Dimensional", "Parallel", "Alternate", "Infinite", "Singularity", "Holographic", "Psychedelic"];
const suffixes = ["Realm", "Dimension", "Universe", "Expanse", "Continuum", "Vortex", "Matrix", "Spectrum", "Horizon", "Infinity", "Cosmos", "Nexus", "Plane", "Domain", "Eclipse", "Paradox", "Mandala", "Fabric", "Construct", "Abyss"];
const descriptors = ["where time folds upon itself", "of shimmering possibilities", "where colors sing", "beyond the veil of perception", "where physics takes a vacation", "of infinite reflections", "where light dances differently", "of impossible geometries", "where dreams take form", "of vibrating energy fields", "where reality glitches beautifully", "of chromatic harmony", "where dimensions intertwine", "of pure potentiality", "where the laws of nature rewrite themselves"];
// Icon options
const icons = [
"fa-atom", "fa-infinity", "fa-star", "fa-moon", "fa-sun",
"fa-galaxy", "fa-meteor", "fa-satellite", "fa-rocket", "fa-ufo",
"fa-shapes", "fa-cubes", "fa-dna", "fa-microscope", "fa-telescope",
"fa-mountain", "fa-water", "fa-fire", "fa-wind", "fa-leaf",
"fa-gem", "fa-crystal-ball", "fa-magic", "fa-hat-wizard", "fa-scroll"
];
// DOM elements
const generateBtn = document.getElementById('generate-btn');
const themeName = document.getElementById('theme-name');
const themeIcon = document.getElementById('theme-icon');
const themeDescription = document.getElementById('theme-description');
const themeDisplay = document.getElementById('theme-display');
const patternDisplay = document.getElementById('pattern-display');
const body = document.querySelector('body');
const particlesContainer = document.getElementById('particles-container');
const historyContainer = document.getElementById('history-container');
const hexCodesContainer = document.getElementById('hex-codes');
const copyHexBtn = document.getElementById('copy-hex-btn');
const toggleCssBtn = document.getElementById('toggle-css-btn');
const cssCodeContainer = document.getElementById('css-code-container');
const cssCode = document.getElementById('css-code');
const copyCssBtn = document.getElementById('copy-css-btn');
// Color elements
const colorElements = [
document.getElementById('color1'),
document.getElementById('color2'),
document.getElementById('color3'),
document.getElementById('color4'),
document.getElementById('color5')
];
// Convert HSL to Hex
function hslToHex(h, s, l) {
l /= 100;
const a = s * Math.min(l, 1 - l) / 100;
const f = n => {
const k = (n + h / 30) % 12;
const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
return Math.round(255 * color).toString(16).padStart(2, '0');
};
return `#${f(0)}${f(8)}${f(4)}`;
}
// Generate random HSL color
function generateRandomColor() {
const h = Math.floor(Math.random() * 360);
const s = Math.floor(Math.random() * 30) + 70; // 70-100% saturation
const l = Math.floor(Math.random() * 30) + 50; // 50-80% lightness
return {
hsl: `hsl(${h}, ${s}%, ${l}%)`,
hex: hslToHex(h, s, l)
};
}
// Generate a harmonious color palette
function generateColorPalette() {
const baseHue = Math.floor(Math.random() * 360);
const colors = [];
// Base color
const baseS = Math.floor(Math.random() * 30) + 70;
const baseL = Math.floor(Math.random() * 30) + 50;
colors.push({
hsl: `hsl(${baseHue}, ${baseS}%, ${baseL}%)`,
hex: hslToHex(baseHue, baseS, baseL)
});
// Analogous colors (adjacent hues)
const analogous1S = Math.floor(Math.random() * 20) + 70;
const analogous1L = Math.floor(Math.random() * 20) + 60;
colors.push({
hsl: `hsl(${(baseHue + 30) % 360}, ${analogous1S}%, ${analogous1L}%)`,
hex: hslToHex((baseHue + 30) % 360, analogous1S, analogous1L)
});
const analogous2S = Math.floor(Math.random() * 20) + 70;
const analogous2L = Math.floor(Math.random() * 20) + 60;
colors.push({
hsl: `hsl(${(baseHue - 30 + 360) % 360}, ${analogous2S}%, ${analogous2L}%)`,
hex: hslToHex((baseHue - 30 + 360) % 360, analogous2S, analogous2L)
});
// Complementary or split-complementary
if (Math.random() > 0.5) {
// Complementary
const compS = Math.floor(Math.random() * 30) + 60;
const compL = Math.floor(Math.random() * 20) + 40;
colors.push({
hsl: `hsl(${(baseHue + 180) % 360}, ${compS}%, ${compL}%)`,
hex: hslToHex((baseHue + 180) % 360, compS, compL)
});
} else {
// Split-complementary
const split1S = Math.floor(Math.random() * 20) + 60;
const split1L = Math.floor(Math.random() * 20) + 40;
colors.push({
hsl: `hsl(${(baseHue + 150) % 360}, ${split1S}%, ${split1L}%)`,
hex: hslToHex((baseHue + 150) % 360, split1S, split1L)
});
const split2S = Math.floor(Math.random() * 20) + 60;
const split2L = Math.floor(Math.random() * 20) + 40;
colors.push({
hsl: `hsl(${(baseHue + 210) % 360}, ${split2S}%, ${split2L}%)`,
hex: hslToHex((baseHue + 210) % 360, split2S, split2L)
});
}
// Accent color (either monochromatic or triadic)
if (Math.random() > 0.5) {
// Monochromatic
const monoL = Math.random() > 0.5 ? baseL + 20 : baseL - 20;
colors.push({
hsl: `hsl(${baseHue}, ${baseS}%, ${monoL}%)`,
hex: hslToHex(baseHue, baseS, monoL)
});
} else {
// Triadic
const triadS = Math.floor(Math.random() * 20) + 70;
const triadL = Math.floor(Math.random() * 20) + 50;
colors.push({
hsl: `hsl(${(baseHue + 120) % 360}, ${triadS}%, ${triadL}%)`,
hex: hslToHex((baseHue + 120) % 360, triadS, triadL)
});
}
// Shuffle and return exactly 5 colors
return colors.sort(() => Math.random() - 0.5).slice(0, 5);
}
// Generate random theme name
function generateThemeName() {
const prefix = prefixes[Math.floor(Math.random() * prefixes.length)];
const suffix = suffixes[Math.floor(Math.random() * suffixes.length)];
return `${prefix} ${suffix}`;
}
// Generate random description
function generateDescription() {
const descriptor = descriptors[Math.floor(Math.random() * descriptors.length)];
return `A mysterious dimension ${descriptor}.`;
}
// Random pattern generators
const patternGenerators = [
function(container, colors) {
// Geometric grid
const angle = Math.floor(Math.random() * 4) * 45;
const size = Math.floor(Math.random() * 30) + 20;
container.style.background = `
linear-gradient(${angle}deg, currentColor 1px, transparent 1px),
linear-gradient(${angle + 90}deg, currentColor 1px, transparent 1px)
`;
container.style.backgroundSize = `${size}px ${size}px`;
return `background: linear-gradient(${angle}deg, var(--color-primary) 1px, transparent 1px),
linear-gradient(${angle + 90}deg, var(--color-primary) 1px, transparent 1px);
background-size: ${size}px ${size}px;`;
},
function(container, colors) {
// Radial gradient
container.style.background = `
radial-gradient(circle at 20% 30%, currentColor 0%, transparent 30%),
radial-gradient(circle at 80% 70%, currentColor 0%, transparent 30%)
`;
return `background: radial-gradient(circle at 20% 30%, var(--color-primary) 0%, transparent 30%),
radial-gradient(circle at 80% 70%, var(--color-primary) 0%, transparent 30%);`;
},
function(container, colors) {
// Particle field
container.innerHTML = '';
const particleCount = Math.floor(Math.random() * 30) + 20;
for (let i = 0; i < particleCount; i++) {
const particle = document.createElement('div');
particle.style.position = 'absolute';
particle.style.color = colors[Math.floor(Math.random() * colors.length)].hsl;
particle.style.opacity = Math.random() * 0.5 + 0.2;
particle.style.width = `${Math.random() * 10 + 2}px`;
particle.style.height = particle.style.width;
particle.style.borderRadius = '50%';
particle.style.left = `${Math.random() * 100}%`;
particle.style.top = `${Math.random() * 100}%`;
container.appendChild(particle);
}
return `/* Particle effect requires JavaScript to implement */`;
},
function(container, colors) {
// Organic shapes
container.innerHTML = '';
const shapeCount = Math.floor(Math.random() * 8) + 3;
for (let i = 0; i < shapeCount; i++) {
const shape = document.createElement('div');
shape.style.position = 'absolute';
shape.style.color = colors[Math.floor(Math.random() * colors.length)].hsl;
shape.style.opacity = Math.random() * 0.4 + 0.2;
shape.style.fontSize = `${Math.random() * 40 + 20}px`;
shape.style.left = `${Math.random() * 100}%`;
shape.style.top = `${Math.random() * 100}%`;
shape.style.transform = `rotate(${Math.random() * 360}deg) scale(${Math.random() * 1.5 + 0.5})`;
const shapeTypes = ['fa-star', 'fa-cloud', 'fa-circle', 'fa-square', 'fa-heart', 'fa-certificate'];
const randomShape = shapeTypes[Math.floor(Math.random() * shapeTypes.length)];
shape.innerHTML = `<i class="fas ${randomShape}"></i>`;
container.appendChild(shape);
}
return `/* Organic shapes effect requires JavaScript to implement */`;
},
function(container, colors) {
// Stripes
const angle = Math.floor(Math.random() * 180);
const width = Math.floor(Math.random() * 30) + 10;
container.style.background = `repeating-linear-gradient(${angle}deg, currentColor 0px, currentColor ${width}px, transparent ${width}px, transparent ${width * 2}px)`;
return `background: repeating-linear-gradient(${angle}deg, var(--color-primary) 0px, var(--color-primary) ${width}px, transparent ${width}px, transparent ${width * 2}px);`;
}
];
// Create floating particles
function createParticles(colors) {
// Clear existing particles
particlesContainer.innerHTML = '';
// Create new particles
const particleCount = Math.floor(Math.random() * 50) + 30;
for (let i = 0; i < particleCount; i++) {
const particle = document.createElement('div');
particle.className = 'particle';
// Random size between 2px and 8px
const size = Math.random() * 6 + 2;
particle.style.width = `${size}px`;
particle.style.height = `${size}px`;
// Random position
particle.style.left = `${Math.random() * 100}%`;
particle.style.top = `${Math.random() * 100}%`;
// Random color from theme
particle.style.color = colors[Math.floor(Math.random() * colors.length)].hsl;
// Random animation
const duration = Math.random() * 30 + 10;
const delay = Math.random() * 10;
const xMovement = (Math.random() - 0.5) * 200;
const yMovement = (Math.random() - 0.5) * 200;
particle.style.animation = `
float ${duration}s ease-in-out ${delay}s infinite,
fade ${duration * 0.7}s ease-in-out infinite
`;
// Keyframes for this particle
const keyframes = `
@keyframes float {
0%, 100% { transform: translate(0, 0); }
50% { transform: translate(${xMovement}px, ${yMovement}px); }
}
@keyframes fade {
0%, 100% { opacity: 0; }
50% { opacity: ${Math.random() * 0.6 + 0.1}; }
}
`;
const style = document.createElement('style');
style.innerHTML = keyframes;
document.head.appendChild(style);
particlesContainer.appendChild(particle);
}
}
// Add to history
function addToHistory(theme) {
const historyItem = document.createElement('div');
historyItem.className = 'flex-shrink-0 w-24 h-24 rounded-xl overflow-hidden border-2 border-white/20 cursor-pointer transition-all hover:scale-105';
historyItem.style.background = `linear-gradient(135deg, ${theme.colors[0].hsl}, ${theme.colors[2].hsl})`;
historyItem.title = theme.name;
historyItem.addEventListener('click', () => {
applyTheme(theme);
});
historyContainer.insertBefore(historyItem, historyContainer.firstChild);
// Limit history to 10 items
if (historyContainer.children.length > 10) {
historyContainer.removeChild(historyContainer.lastChild);
}
}
// Generate CSS code for the current theme
function generateCSSCode(theme) {
let css = `:root {
/* Color Variables */
--color-primary: ${theme.colors[0].hsl};
--color-secondary: ${theme.colors[1].hsl};
--color-accent: ${theme.colors[2].hsl};
--color-background: ${theme.colors[3].hsl};
--color-text: ${theme.colors[4].hsl};
/* Hex Codes */
/* Primary: ${theme.colors[0].hex} */
/* Secondary: ${theme.colors[1].hex} */
/* Accent: ${theme.colors[2].hex} */
/* Background: ${theme.colors[3].hex} */
/* Text: ${theme.colors[4].hex} */
}
body {
background: linear-gradient(to bottom right, var(--color-primary), var(--color-accent));
color: var(--color-text);
}
/* Pattern Styles */
.pattern {
${theme.patternCSS}
}`;
return css;
}
// Update hex code display
function updateHexCodes(colors) {
hexCodesContainer.innerHTML = '';
colors.forEach((color, index) => {
const hexCode = document.createElement('div');
hexCode.className = 'flex items-center gap-1';
hexCode.innerHTML = `
<span class="inline-block w-3 h-3 rounded-full" style="background-color: ${color.hex}"></span>
<span>${color.hex}</span>
`;
hexCodesContainer.appendChild(hexCode);
});
// Update tooltips
colorElements.forEach((el, index) => {
const tooltip = el.querySelector('.hex-tooltip');
if (tooltip) {
tooltip.textContent = colors[index].hex;
}
});
}
// Apply a theme
function applyTheme(theme) {
// Update theme info
themeName.textContent = theme.name;
themeIcon.innerHTML = `<i class="fas ${theme.icon}"></i>`;
themeDescription.textContent = theme.description;
// Update colors
theme.colors.forEach((color, index) => {
colorElements[index].style.backgroundColor = color.hsl;
});
// Update hex codes
updateHexCodes(theme.colors);
// Set main color
const mainColor = theme.colors[0].hsl;
themeDisplay.style.borderColor = `${mainColor}80`;
// Apply pattern
patternDisplay.innerHTML = '';
patternDisplay.style.color = theme.colors[2].hsl;
theme.patternCSS = theme.patternGenerator(patternDisplay, theme.colors);
// Update background gradient
body.style.background = `linear-gradient(to bottom right, ${theme.colors[0].hsl}, ${theme.colors[2].hsl})`;
// Create particles
createParticles(theme.colors);
// Generate CSS code
cssCode.textContent = generateCSSCode(theme);
}
// Generate random theme
function generateRandomTheme() {
const colors = generateColorPalette();
const theme = {
name: generateThemeName(),
icon: icons[Math.floor(Math.random() * icons.length)],
description: generateDescription(),
colors: colors,
patternGenerator: patternGenerators[Math.floor(Math.random() * patternGenerators.length)],
patternCSS: ''
};
addToHistory(theme);
applyTheme(theme);
}
// Copy text to clipboard
function copyToClipboard(text, button) {
navigator.clipboard.writeText(text).then(() => {
button.classList.add('copied');
button.innerHTML = '<i class="fas fa-check"></i> Copied!';
setTimeout(() => {
button.classList.remove('copied');
if (button.id === 'copy-hex-btn') {
button.innerHTML = '<i class="fas fa-copy"></i> Copy';
} else {
button.innerHTML = '<i class="fas fa-copy"></i> Copy';
}
}, 2000);
});
}
// Initial generation
generateRandomTheme();
// Button click event
generateBtn.addEventListener('click', () => {
// Add click animation
generateBtn.classList.add('active:scale-95');
setTimeout(() => {
generateBtn.classList.remove('active:scale-95');
}, 150);
generateRandomTheme();
});
// Toggle CSS code container
toggleCssBtn.addEventListener('click', () => {
cssCodeContainer.classList.toggle('open');
if (cssCodeContainer.classList.contains('open')) {
toggleCssBtn.innerHTML = '<i class="fas fa-code"></i> Hide CSS Code';
} else {
toggleCssBtn.innerHTML = '<i class="fas fa-code"></i> Generate CSS Code';
}
});
// Copy hex codes
copyHexBtn.addEventListener('click', () => {
const hexCodes = Array.from(hexCodesContainer.querySelectorAll('div')).map(div => {
return div.textContent.trim().split('\n').pop().trim();
}).join('\n');
copyToClipboard(hexCodes, copyHexBtn);
});
// Copy CSS code
copyCssBtn.addEventListener('click', () => {
copyToClipboard(cssCode.textContent, copyCssBtn);
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - <a href="https://enzostvs-deepsite.hf.space?remix=druvx13/infinite-universe-explorer" style="color: #fff;text-decoration: underline;" target="_blank" >🧬 Remix</a></p></body>
</html> |