js实现图片色调配色提取器代码
代码语言:html
所属分类:其他
代码描述:js实现图片色调配色提取器代码,支持自定义色调数量提取,支持网页图片和本地图片
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css'>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
body {
background-color: #f5f7fa;
color: #333;
line-height: 1.6;
min-height: 100vh;
position: relative;
overflow-x: hidden;
}
body::before {
content: "";
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url(//repo.bfw.wiki/bfwrepo/image/5d6539385ad28.png);
background-size: cover;
background-position: center;
background-repeat: no-repeat;
z-index: -1;
transition: background-image 0.5s ease;
}
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
}
.container {
margin: 0 auto;
padding: 20px;
display: flex;
flex-direction: column;
gap: 20px;
position: relative;
z-index: 1;
min-height: 100vh;
}
.controls-container {
position: absolute;
bottom: 20px;
right: 20px;
width: 100%;
max-width: 180px;
display: flex;
justify-content: flex-end;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 10px;
}
.upload-btn-wrapper {
position: relative;
overflow: hidden;
display: inline-block;
min-width: 180px;
}
.btn {
padding: 12px 20px;
background-color: #fff;
color: #000;
border: none;
border-radius: 8px;
font-size: 0.95rem;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
width: 100%;
border: #000 solid 1px;
}
.btn:hover {
background-color: #2ecc71;
box-shadow: 0 5px 15px rgb(46 204 113 / 0.3);
}
/* 修复部分:删除了 pointer-events: none; 以允许点击 */
.upload-btn-wrapper input[type="file"] {
position: absolute;
left: 0;
top: 0;
opacity: 0;
width: 100%;
height: 100%;
cursor: pointer;
}
.copy-palette-btn {
background-color: #fff;
border: #000 solid 1px;
min-width: 180px;
}
.copy-palette-btn:hover {
background-color: #2ecc71;
color: #fff;
box-shadow: 0 5px 15px rgb(46 204 113 / 0.3);
}
.palette-container {
border-radius: 16px;
padding: 20px;
box-shadow: 0 15px 30px rgb(0 0 0 / 0.15);
display: flex;
flex-direction: column;
width: 200px;
flex-shrink: 0;
max-height: calc(100vh - 160px);
margin-left: auto;
border: 1px solid rgb(0 0 0 / 0.1);
backdrop-filter: blur(10px);
}
.palette-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
padding-bottom: 15px;
border-bottom: 1px solid rgb(0 0 0 / 0.1);
}
.color-count-selector {
position: relative;
display: inline-block;
width: 100%;
}
.color-count-badge {
display: inline-flex;
width: 100%;
alig.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0