색상 팔레트 추출기
홈
더 많은 도구
English
中文
日本語
Deutsch
Français
Español
Português
العربية
const swatchWidth = 100; const swatchHeight = 80; canvas.width = swatchWidth * palette.length; canvas.height = swatchHeight; palette.forEach((color, i) => { ctx.fillStyle = color.hex; ctx.fillRect(i * swatchWidth, 0, swatchWidth, swatchHeight); // Add hex text ctx.fillStyle = getContrastColor(color.r, color.g, color.b); ctx.font = 'bold 14px monospace'; ctx.textAlign = 'center'; ctx.fillText(color.hex, i * swatchWidth + swatchWidth / 2, swatchHeight / 2 + 5); }); canvas.toBlob(blob => { const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = 'palette.png'; a.click(); URL.revokeObjectURL(url); }); } } function getContrastColor(r, g, b) { // Calculate luminance const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255; return luminance > 0.5 ? '#000000' : '#FFFFFF'; } function resetAll() { state.image = null; state.palette = []; fileInput.value = ''; resultsSection.style.display = 'none'; processingArea.style.display = 'none'; uploadArea.style.display = 'block'; colorCountSlider.value = 8; colorCountValue.textContent = '8'; }