Add 3 files
Browse files- README.md +7 -5
- index.html +480 -19
- prompts.txt +0 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: css
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: red
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,480 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="he" dir="rtl">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>בורר צבעים מתקדם</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
.color-preview {
|
| 11 |
+
width: 150px;
|
| 12 |
+
height: 150px;
|
| 13 |
+
border-radius: 12px;
|
| 14 |
+
box-shadow: 0 4px 20px rgba(0,0,0,0.15);
|
| 15 |
+
border: 2px solid white;
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
.color-code-display {
|
| 19 |
+
font-family: 'Courier New', monospace;
|
| 20 |
+
background-color: #f8f9fa;
|
| 21 |
+
padding: 12px 20px;
|
| 22 |
+
border-radius: 8px;
|
| 23 |
+
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
|
| 24 |
+
transition: all 0.3s ease;
|
| 25 |
+
font-size: 1.1rem;
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
.color-code-display.copied {
|
| 29 |
+
background-color: #4CAF50;
|
| 30 |
+
color: white;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
.canvas-container {
|
| 34 |
+
position: relative;
|
| 35 |
+
border-radius: 12px;
|
| 36 |
+
overflow: hidden;
|
| 37 |
+
box-shadow: 0 8px 30px rgba(0,0,0,0.2);
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
#colorCanvas {
|
| 41 |
+
cursor: crosshair;
|
| 42 |
+
display: block;
|
| 43 |
+
width: 100%;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
.picker-circle {
|
| 47 |
+
position: absolute;
|
| 48 |
+
width: 20px;
|
| 49 |
+
height: 20px;
|
| 50 |
+
border-radius: 50%;
|
| 51 |
+
border: 2px solid white;
|
| 52 |
+
box-shadow: 0 0 5px rgba(0,0,0,0.5);
|
| 53 |
+
pointer-events: none;
|
| 54 |
+
transform: translate(-10px, -10px);
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
.gradient-bg {
|
| 58 |
+
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
.tab-button {
|
| 62 |
+
transition: all 0.3s ease;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
.tab-button.active {
|
| 66 |
+
background-color: #3b82f6;
|
| 67 |
+
color: white;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
/* Custom slider style */
|
| 71 |
+
.brightness-slider {
|
| 72 |
+
-webkit-appearance: none;
|
| 73 |
+
width: 100%;
|
| 74 |
+
height: 10px;
|
| 75 |
+
border-radius: 5px;
|
| 76 |
+
background: linear-gradient(to right, #000, #fff);
|
| 77 |
+
outline: none;
|
| 78 |
+
margin-top: 15px;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
.brightness-slider::-webkit-slider-thumb {
|
| 82 |
+
-webkit-appearance: none;
|
| 83 |
+
appearance: none;
|
| 84 |
+
width: 20px;
|
| 85 |
+
height: 20px;
|
| 86 |
+
border-radius: 50%;
|
| 87 |
+
background: #fff;
|
| 88 |
+
cursor: pointer;
|
| 89 |
+
border: 2px solid #3b82f6;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
.brightness-slider::-moz-range-thumb {
|
| 93 |
+
width: 20px;
|
| 94 |
+
height: 20px;
|
| 95 |
+
border-radius: 50%;
|
| 96 |
+
background: #fff;
|
| 97 |
+
cursor: pointer;
|
| 98 |
+
border: 2px solid #3b82f6;
|
| 99 |
+
}
|
| 100 |
+
</style>
|
| 101 |
+
</head>
|
| 102 |
+
<body class="gradient-bg min-h-screen flex flex-col items-center justify-center p-4">
|
| 103 |
+
<div class="w-full max-w-4xl bg-white rounded-2xl shadow-xl overflow-hidden">
|
| 104 |
+
<div class="p-8">
|
| 105 |
+
<div class="flex items-center justify-center mb-6">
|
| 106 |
+
<i class="fas fa-eye-dropper text-4xl ml-3 text-indigo-600"></i>
|
| 107 |
+
<h1 class="text-3xl font-bold text-gray-800">בורר צבעים מתקדם</h1>
|
| 108 |
+
</div>
|
| 109 |
+
|
| 110 |
+
<div class="flex mb-6 border-b border-gray-200">
|
| 111 |
+
<button class="tab-button active px-4 py-2 rounded-t-lg font-medium" data-tab="picker">בורר צבעים</button>
|
| 112 |
+
<button class="tab-button px-4 py-2 rounded-t-lg font-medium" data-tab="palette">פלטת צבעים</button>
|
| 113 |
+
</div>
|
| 114 |
+
|
| 115 |
+
<div id="pickerTab" class="tab-content">
|
| 116 |
+
<div class="flex flex-col md:flex-row gap-8 mb-8">
|
| 117 |
+
<div class="flex-1">
|
| 118 |
+
<div class="canvas-container relative mb-4">
|
| 119 |
+
<canvas id="colorCanvas" width="500" height="300"></canvas>
|
| 120 |
+
<div class="picker-circle" id="pickerCircle"></div>
|
| 121 |
+
</div>
|
| 122 |
+
<input type="range" min="0" max="100" value="50" class="brightness-slider" id="brightnessSlider">
|
| 123 |
+
<p class="text-gray-600 text-center mt-2">גרור את הסליידר כדי לשנות את הבהירות</p>
|
| 124 |
+
<p class="text-gray-600 text-center mt-2">לחץ או גרור על הקנבס כדי לבחור צבע</p>
|
| 125 |
+
</div>
|
| 126 |
+
|
| 127 |
+
<div class="flex flex-col items-center">
|
| 128 |
+
<div class="color-preview mb-4" id="colorPreview"></div>
|
| 129 |
+
|
| 130 |
+
<div class="text-center mb-6">
|
| 131 |
+
<p class="text-gray-700 mb-3 font-medium">קוד הצבע הנבחר:</p>
|
| 132 |
+
<div class="color-code-display flex items-center justify-center" id="colorCodeDisplay">
|
| 133 |
+
<span id="colorCodeText">בחר צבע מהקנבס</span>
|
| 134 |
+
<button id="copyButton" class="ml-3 p-1 rounded-md hover:bg-gray-200 transition-colors" title="העתק ללוח">
|
| 135 |
+
<i class="fas fa-copy text-gray-500"></i>
|
| 136 |
+
</button>
|
| 137 |
+
</div>
|
| 138 |
+
</div>
|
| 139 |
+
|
| 140 |
+
<div class="grid grid-cols-3 gap-4 w-full">
|
| 141 |
+
<div class="flex flex-col items-center">
|
| 142 |
+
<p class="text-sm text-gray-600 mb-1">RGB</p>
|
| 143 |
+
<div class="bg-gray-100 p-2 rounded" id="rgbCode">0, 0, 0</div>
|
| 144 |
+
</div>
|
| 145 |
+
<div class="flex flex-col items-center">
|
| 146 |
+
<p class="text-sm text-gray-600 mb-1">HEX</p>
|
| 147 |
+
<div class="bg-gray-100 p-2 rounded" id="hexCode">#000000</div>
|
| 148 |
+
</div>
|
| 149 |
+
<div class="flex flex-col items-center">
|
| 150 |
+
<p class="text-sm text-gray-600 mb-1">HSL</p>
|
| 151 |
+
<div class="bg-gray-100 p-2 rounded" id="hslCode">0°, 0%, 0%</div>
|
| 152 |
+
</div>
|
| 153 |
+
</div>
|
| 154 |
+
</div>
|
| 155 |
+
</div>
|
| 156 |
+
</div>
|
| 157 |
+
|
| 158 |
+
<div id="paletteTab" class="tab-content hidden">
|
| 159 |
+
<div class="flex justify-center mb-6">
|
| 160 |
+
<div class="grid grid-cols-10 gap-2" id="colorGrid"></div>
|
| 161 |
+
</div>
|
| 162 |
+
<div class="flex justify-center">
|
| 163 |
+
<div class="color-code-display flex items-center" id="paletteColorCode">
|
| 164 |
+
<span id="paletteColorText">לחץ על צבע למעלה</span>
|
| 165 |
+
<button id="paletteCopyButton" class="ml-3 p-1 rounded-md hover:bg-gray-200 transition-colors" title="העתק ללוח">
|
| 166 |
+
<i class="fas fa-copy text-gray-500"></i>
|
| 167 |
+
</button>
|
| 168 |
+
</div>
|
| 169 |
+
</div>
|
| 170 |
+
</div>
|
| 171 |
+
</div>
|
| 172 |
+
|
| 173 |
+
<div class="bg-gray-50 p-4 text-center text-sm text-gray-500">
|
| 174 |
+
<p>השתמש בקוד RGB ב-CSS שלך כך: <code class="bg-gray-100 px-2 py-1 rounded">color: rgb(255, 0, 0);</code></p>
|
| 175 |
+
</div>
|
| 176 |
+
</div>
|
| 177 |
+
|
| 178 |
+
<script>
|
| 179 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 180 |
+
// Tab switching
|
| 181 |
+
const tabs = document.querySelectorAll('.tab-button');
|
| 182 |
+
tabs.forEach(tab => {
|
| 183 |
+
tab.addEventListener('click', function() {
|
| 184 |
+
tabs.forEach(t => t.classList.remove('active'));
|
| 185 |
+
this.classList.add('active');
|
| 186 |
+
|
| 187 |
+
document.getElementById('pickerTab').classList.toggle('hidden', this.dataset.tab !== 'picker');
|
| 188 |
+
document.getElementById('paletteTab').classList.toggle('hidden', this.dataset.tab !== 'palette');
|
| 189 |
+
});
|
| 190 |
+
});
|
| 191 |
+
|
| 192 |
+
// Color Picker Tab
|
| 193 |
+
const canvas = document.getElementById('colorCanvas');
|
| 194 |
+
const ctx = canvas.getContext('2d');
|
| 195 |
+
const pickerCircle = document.getElementById('pickerCircle');
|
| 196 |
+
const colorPreview = document.getElementById('colorPreview');
|
| 197 |
+
const colorCodeText = document.getElementById('colorCodeText');
|
| 198 |
+
const colorCodeDisplay = document.getElementById('colorCodeDisplay');
|
| 199 |
+
const copyButton = document.getElementById('copyButton');
|
| 200 |
+
const rgbCode = document.getElementById('rgbCode');
|
| 201 |
+
const hexCode = document.getElementById('hexCode');
|
| 202 |
+
const hslCode = document.getElementById('hslCode');
|
| 203 |
+
const brightnessSlider = document.getElementById('brightnessSlider');
|
| 204 |
+
|
| 205 |
+
let currentBrightness = 50;
|
| 206 |
+
let currentColor = { r: 0, g: 0, b: 0 };
|
| 207 |
+
|
| 208 |
+
// Create gradient for canvas
|
| 209 |
+
function createColorCanvas() {
|
| 210 |
+
const width = canvas.width;
|
| 211 |
+
const height = canvas.height;
|
| 212 |
+
|
| 213 |
+
// Clear canvas
|
| 214 |
+
ctx.clearRect(0, 0, width, height);
|
| 215 |
+
|
| 216 |
+
// Main gradient (left to right)
|
| 217 |
+
const mainGradient = ctx.createLinearGradient(0, 0, width, 0);
|
| 218 |
+
mainGradient.addColorStop(0, 'rgb(255, 0, 0)');
|
| 219 |
+
mainGradient.addColorStop(0.17, 'rgb(255, 0, 255)');
|
| 220 |
+
mainGradient.addColorStop(0.34, 'rgb(0, 0, 255)');
|
| 221 |
+
mainGradient.addColorStop(0.51, 'rgb(0, 255, 255)');
|
| 222 |
+
mainGradient.addColorStop(0.68, 'rgb(0, 255, 0)');
|
| 223 |
+
mainGradient.addColorStop(0.85, 'rgb(255, 255, 0)');
|
| 224 |
+
mainGradient.addColorStop(1, 'rgb(255, 0, 0)');
|
| 225 |
+
|
| 226 |
+
ctx.fillStyle = mainGradient;
|
| 227 |
+
ctx.fillRect(0, 0, width, height);
|
| 228 |
+
|
| 229 |
+
// White to transparent gradient (top to bottom)
|
| 230 |
+
const whiteGradient = ctx.createLinearGradient(0, 0, 0, height);
|
| 231 |
+
whiteGradient.addColorStop(0, 'rgba(255, 255, 255, 1)');
|
| 232 |
+
whiteGradient.addColorStop(1, 'rgba(255, 255, 255, 0)');
|
| 233 |
+
|
| 234 |
+
ctx.fillStyle = whiteGradient;
|
| 235 |
+
ctx.fillRect(0, 0, width, height);
|
| 236 |
+
|
| 237 |
+
// Black to transparent gradient (bottom to top)
|
| 238 |
+
const blackGradient = ctx.createLinearGradient(0, 0, 0, height);
|
| 239 |
+
blackGradient.addColorStop(0, 'rgba(0, 0, 0, 0)');
|
| 240 |
+
blackGradient.addColorStop(1, 'rgba(0, 0, 0, ' + (1 - currentBrightness/100) + ')');
|
| 241 |
+
|
| 242 |
+
ctx.fillStyle = blackGradient;
|
| 243 |
+
ctx.fillRect(0, 0, width, height);
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
// Get color from canvas
|
| 247 |
+
function pickColor(e) {
|
| 248 |
+
const rect = canvas.getBoundingClientRect();
|
| 249 |
+
const x = e.clientX - rect.left;
|
| 250 |
+
const y = e.clientY - rect.top;
|
| 251 |
+
|
| 252 |
+
// Update picker circle position
|
| 253 |
+
pickerCircle.style.left = x + 'px';
|
| 254 |
+
pickerCircle.style.top = y + 'px';
|
| 255 |
+
|
| 256 |
+
// Get pixel data
|
| 257 |
+
const pixel = ctx.getImageData(x, y, 1, 1).data;
|
| 258 |
+
currentColor = {
|
| 259 |
+
r: pixel[0],
|
| 260 |
+
g: pixel[1],
|
| 261 |
+
b: pixel[2]
|
| 262 |
+
};
|
| 263 |
+
|
| 264 |
+
updateColorDisplays();
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
+
// Update all color displays
|
| 268 |
+
function updateColorDisplays() {
|
| 269 |
+
const r = currentColor.r;
|
| 270 |
+
const g = currentColor.g;
|
| 271 |
+
const b = currentColor.b;
|
| 272 |
+
|
| 273 |
+
// Update displays
|
| 274 |
+
const rgbValue = `rgb(${r}, ${g}, ${b})`;
|
| 275 |
+
colorPreview.style.backgroundColor = rgbValue;
|
| 276 |
+
colorCodeText.textContent = rgbValue;
|
| 277 |
+
pickerCircle.style.backgroundColor = rgbValue;
|
| 278 |
+
|
| 279 |
+
// Update code displays
|
| 280 |
+
rgbCode.textContent = `${r}, ${g}, ${b}`;
|
| 281 |
+
hexCode.textContent = rgbToHex(r, g, b);
|
| 282 |
+
hslCode.textContent = rgbToHsl(r, g, b);
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
// Event listeners for canvas
|
| 286 |
+
canvas.addEventListener('mousemove', function(e) {
|
| 287 |
+
if (isDragging) {
|
| 288 |
+
pickColor(e);
|
| 289 |
+
}
|
| 290 |
+
});
|
| 291 |
+
|
| 292 |
+
canvas.addEventListener('mousedown', function(e) {
|
| 293 |
+
isDragging = true;
|
| 294 |
+
pickColor(e);
|
| 295 |
+
});
|
| 296 |
+
|
| 297 |
+
canvas.addEventListener('mouseup', function() {
|
| 298 |
+
isDragging = false;
|
| 299 |
+
});
|
| 300 |
+
|
| 301 |
+
canvas.addEventListener('mouseleave', function() {
|
| 302 |
+
isDragging = false;
|
| 303 |
+
});
|
| 304 |
+
|
| 305 |
+
canvas.addEventListener('click', pickColor);
|
| 306 |
+
|
| 307 |
+
// Brightness slider event
|
| 308 |
+
brightnessSlider.addEventListener('input', function() {
|
| 309 |
+
currentBrightness = this.value;
|
| 310 |
+
createColorCanvas();
|
| 311 |
+
|
| 312 |
+
// If we have a selected color, adjust it to the new brightness
|
| 313 |
+
if (currentColor) {
|
| 314 |
+
const hsl = rgbToHslObject(currentColor.r, currentColor.g, currentColor.b);
|
| 315 |
+
hsl.l = currentBrightness / 100;
|
| 316 |
+
const rgb = hslToRgb(hsl.h, hsl.s, hsl.l);
|
| 317 |
+
currentColor = {
|
| 318 |
+
r: rgb[0],
|
| 319 |
+
g: rgb[1],
|
| 320 |
+
b: rgb[2]
|
| 321 |
+
};
|
| 322 |
+
updateColorDisplays();
|
| 323 |
+
}
|
| 324 |
+
});
|
| 325 |
+
|
| 326 |
+
let isDragging = false;
|
| 327 |
+
|
| 328 |
+
// Helper functions
|
| 329 |
+
function rgbToHex(r, g, b) {
|
| 330 |
+
return '#' + [r, g, b].map(x => {
|
| 331 |
+
const hex = x.toString(16);
|
| 332 |
+
return hex.length === 1 ? '0' + hex : hex;
|
| 333 |
+
}).join('');
|
| 334 |
+
}
|
| 335 |
+
|
| 336 |
+
function rgbToHsl(r, g, b) {
|
| 337 |
+
const hsl = rgbToHslObject(r, g, b);
|
| 338 |
+
return `${Math.round(hsl.h * 360)}°, ${Math.round(hsl.s * 100)}%, ${Math.round(hsl.l * 100)}%`;
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
function rgbToHslObject(r, g, b) {
|
| 342 |
+
r /= 255, g /= 255, b /= 255;
|
| 343 |
+
|
| 344 |
+
const max = Math.max(r, g, b), min = Math.min(r, g, b);
|
| 345 |
+
let h, s, l = (max + min) / 2;
|
| 346 |
+
|
| 347 |
+
if (max === min) {
|
| 348 |
+
h = s = 0; // achromatic
|
| 349 |
+
} else {
|
| 350 |
+
const d = max - min;
|
| 351 |
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
| 352 |
+
|
| 353 |
+
switch (max) {
|
| 354 |
+
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
| 355 |
+
case g: h = (b - r) / d + 2; break;
|
| 356 |
+
case b: h = (r - g) / d + 4; break;
|
| 357 |
+
}
|
| 358 |
+
|
| 359 |
+
h /= 6;
|
| 360 |
+
}
|
| 361 |
+
|
| 362 |
+
return { h, s, l };
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
// Copy to clipboard
|
| 366 |
+
copyButton.addEventListener('click', function() {
|
| 367 |
+
const textToCopy = colorCodeText.textContent;
|
| 368 |
+
if (textToCopy === 'בחר צבע מהקנבס') return;
|
| 369 |
+
|
| 370 |
+
navigator.clipboard.writeText(textToCopy).then(function() {
|
| 371 |
+
colorCodeDisplay.classList.add('copied');
|
| 372 |
+
colorCodeText.textContent = 'הועתק!';
|
| 373 |
+
|
| 374 |
+
setTimeout(function() {
|
| 375 |
+
colorCodeDisplay.classList.remove('copied');
|
| 376 |
+
colorCodeText.textContent = textToCopy;
|
| 377 |
+
}, 2000);
|
| 378 |
+
});
|
| 379 |
+
});
|
| 380 |
+
|
| 381 |
+
// Color Palette Tab
|
| 382 |
+
const colorGrid = document.getElementById('colorGrid');
|
| 383 |
+
const paletteColorText = document.getElementById('paletteColorText');
|
| 384 |
+
const paletteColorCode = document.getElementById('paletteColorCode');
|
| 385 |
+
const paletteCopyButton = document.getElementById('paletteCopyButton');
|
| 386 |
+
|
| 387 |
+
// Generate color grid
|
| 388 |
+
const hueSteps = 10;
|
| 389 |
+
const saturationSteps = 10;
|
| 390 |
+
|
| 391 |
+
for (let h = 0; h < hueSteps; h++) {
|
| 392 |
+
for (let s = 0; s < saturationSteps; s++) {
|
| 393 |
+
const hue = Math.floor(h * 360 / hueSteps);
|
| 394 |
+
const saturation = 30 + Math.floor(s * 70 / saturationSteps);
|
| 395 |
+
|
| 396 |
+
const colorCell = document.createElement('div');
|
| 397 |
+
colorCell.className = 'w-8 h-8 rounded cursor-pointer transition-transform hover:scale-125';
|
| 398 |
+
colorCell.style.backgroundColor = `hsl(${hue}, ${saturation}%, 50%)`;
|
| 399 |
+
|
| 400 |
+
const rgbColor = hslToRgb(hue/360, saturation/100, 0.5);
|
| 401 |
+
colorCell.dataset.rgb = `rgb(${rgbColor[0]}, ${rgbColor[1]}, ${rgbColor[2]})`;
|
| 402 |
+
|
| 403 |
+
colorCell.addEventListener('click', function() {
|
| 404 |
+
const rgbValue = this.dataset.rgb;
|
| 405 |
+
paletteColorText.textContent = rgbValue;
|
| 406 |
+
});
|
| 407 |
+
|
| 408 |
+
colorGrid.appendChild(colorCell);
|
| 409 |
+
}
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
// Add grayscale colors
|
| 413 |
+
for (let i = 0; i < 10; i++) {
|
| 414 |
+
const grayValue = Math.floor(i * 255 / 9);
|
| 415 |
+
const colorCell = document.createElement('div');
|
| 416 |
+
colorCell.className = 'w-8 h-8 rounded cursor-pointer transition-transform hover:scale-125';
|
| 417 |
+
colorCell.style.backgroundColor = `rgb(${grayValue}, ${grayValue}, ${grayValue})`;
|
| 418 |
+
colorCell.dataset.rgb = `rgb(${grayValue}, ${grayValue}, ${grayValue})`;
|
| 419 |
+
|
| 420 |
+
colorCell.addEventListener('click', function() {
|
| 421 |
+
const rgbValue = this.dataset.rgb;
|
| 422 |
+
paletteColorText.textContent = rgbValue;
|
| 423 |
+
});
|
| 424 |
+
|
| 425 |
+
colorGrid.appendChild(colorCell);
|
| 426 |
+
}
|
| 427 |
+
|
| 428 |
+
// Copy for palette
|
| 429 |
+
paletteCopyButton.addEventListener('click', function() {
|
| 430 |
+
const textToCopy = paletteColorText.textContent;
|
| 431 |
+
if (textToCopy === 'לחץ על צבע למעלה') return;
|
| 432 |
+
|
| 433 |
+
navigator.clipboard.writeText(textToCopy).then(function() {
|
| 434 |
+
paletteColorCode.classList.add('copied');
|
| 435 |
+
paletteColorText.textContent = 'הועתק!';
|
| 436 |
+
|
| 437 |
+
setTimeout(function() {
|
| 438 |
+
paletteColorCode.classList.remove('copied');
|
| 439 |
+
paletteColorText.textContent = textToCopy;
|
| 440 |
+
}, 2000);
|
| 441 |
+
});
|
| 442 |
+
});
|
| 443 |
+
|
| 444 |
+
// Helper function for palette
|
| 445 |
+
function hslToRgb(h, s, l) {
|
| 446 |
+
let r, g, b;
|
| 447 |
+
|
| 448 |
+
if (s === 0) {
|
| 449 |
+
r = g = b = l;
|
| 450 |
+
} else {
|
| 451 |
+
const hue2rgb = function hue2rgb(p, q, t) {
|
| 452 |
+
if (t < 0) t += 1;
|
| 453 |
+
if (t > 1) t -= 1;
|
| 454 |
+
if (t < 1/6) return p + (q - p) * 6 * t;
|
| 455 |
+
if (t < 1/2) return q;
|
| 456 |
+
if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;
|
| 457 |
+
return p;
|
| 458 |
+
};
|
| 459 |
+
|
| 460 |
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
| 461 |
+
const p = 2 * l - q;
|
| 462 |
+
|
| 463 |
+
r = hue2rgb(p, q, h + 1/3);
|
| 464 |
+
g = hue2rgb(p, q, h);
|
| 465 |
+
b = hue2rgb(p, q, h - 1/3);
|
| 466 |
+
}
|
| 467 |
+
|
| 468 |
+
return [
|
| 469 |
+
Math.round(r * 255),
|
| 470 |
+
Math.round(g * 255),
|
| 471 |
+
Math.round(b * 255)
|
| 472 |
+
];
|
| 473 |
+
}
|
| 474 |
+
|
| 475 |
+
// Initialize
|
| 476 |
+
createColorCanvas();
|
| 477 |
+
});
|
| 478 |
+
</script>
|
| 479 |
+
<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=nhkr/css" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 480 |
+
</html>
|
prompts.txt
ADDED
|
File without changes
|