这是一份可直接运行的 HTML/CSS/JS 交互工具页面四通道色彩空间切换 滤镜叠加画面区域会实时预览方便你对照不同组合效果。!DOCTYPE html html langzh-CN head meta charsetUTF-8 meta nameviewport contentwidthdevice-width, initial-scale1.0 title色彩空间四通道 · 切换演示/title style * { box-sizing: border-box; margin: 0; padding: 0; } body { background: #1b1e26; color: #e8ecf2; font-family: system-ui, -apple-system, Segoe UI, Roboto, PingFang SC, Microsoft YaHei, sans-serif; display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; } .app { width: 100%; max-width: 980px; background: #232733; border-radius: 16px; padding: 24px 26px 28px; box-shadow: 0 18px 48px rgba(0,0,0,.45); } h1 { font-size: 20px; font-weight: 600; letter-spacing: .5px; margin-bottom: 4px; } .sub { font-size: 13px; color: #9aa4b8; margin-bottom: 18px; } /* 模式按钮 */ .modes { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; } .mode-btn { flex: 1 1 0; min-width: 120px; padding: 10px 12px; background: #2e3343; border: 1px solid #3c4356; border-radius: 10px; color: #b9c2d4; font-size: 14px; cursor: pointer; transition: .18s; user-select: none; } .mode-btn:hover { background: #373d50; color: #e8ecf2; } .mode-btn.active { background: #3f7cff; border-color: #3f7cff; color: #fff; box-shadow: 0 4px 14px rgba(63,124,255,.4); } /* 舞台 */ .stage { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #11141b; margin-bottom: 18px; } .scene { position: absolute; inset: 0; transition: filter .25s ease; } /* 场景一个渐变天空 地面 圆形物体 */ .sky { position: absolute; inset: 0; background: linear-gradient(180deg, #6fb1ff 0%, #a6d4ff 55%, #d9ecff 100%); } .ground { position: absolute; left: 0; right: 0; bottom: 0; height: 38%; background: linear-gradient(180deg, #4caf6d 0%, #2e7d4f 100%); } .sun { position: absolute; width: 16%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6c4, #ffcf3d 55%, #ff9f1a 100%); top: 12%; left: 12%; box-shadow: 0 0 40px rgba(255,190,60,.65); } .ball { position: absolute; width: 22%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #ffffff, #ff5c8a 45%, #b3174f 100%); bottom: 12%; right: 14%; box-shadow: 0 14px 30px rgba(0,0,0,.35); } .box { position: absolute; width: 14%; aspect-ratio: 1; background: linear-gradient(135deg, #ffd166, #ef8b2c); border-radius: 10px; bottom: 30%; left: 32%; box-shadow: 0 10px 22px rgba(0,0,0,.3); } .caption { position: absolute; left: 12px; bottom: 10px; font-size: 12px; color: rgba(255,255,255,.85); background: rgba(0,0,0,.4); padding: 4px 10px; border-radius: 6px; backdrop-filter: blur(2px); } /* 滤镜控件 */ .filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; } .filter-card { background: #2a2f3d; border: 1px solid #3a4154; border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; } .filter-card .head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: #c4cddf; } .filter-card .head label { display: flex; align-items: center; gap: 6px; cursor: pointer; } .filter-card input[typecheckbox] { width: 15px; height: 15px; accent-color: #3f7cff; cursor: pointer; } .filter-card input[typerange] { width: 100%; accent-color: #3f7cff; cursor: pointer; } .val { font-size: 12px; color: #8f9ab2; font-variant-numeric: tabular-nums; } /* 色板 */ .swatches { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; } .swatch { flex: 1 1 0; min-width: 90px; border-radius: 10px; padding: 10px; text-align: center; font-size: 12px; font-weight: 600; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.45); transition: box-shadow .2s; } .swatch.red { background: #e74c3c; } .swatch.green { background: #27ae60; } .swatch.blue { background: #2f80ed; } .swatch.gray { background: #7f8c8d; } .hint { margin-top: 14px; font-size: 12px; color: #7b869c; line-height: 1.6; } code { background: #1a1e27; padding: 1px 6px; border-radius: 4px; font-size: 12px; color: #8ec5ff; } /style /head body div classapp h1色彩空间四通道 · 切换演示/h1 div classsub切换 RGB / HSV / HSL / LAB叠加滤镜实时查看画面变化/div !-- 模式 -- div classmodes idmodes button classmode-btn active>
阅读完成 · 觉得有帮助?