引入:
1.通过JavaScript 常见三个滑动条,设置范围(0-255),分别表示 r g b
2.将 r g b 转为颜色,并设置为画布的背景颜色
3.通过浏览器开发者工具截取节点屏幕截图并保存
4.设为桌面背景运行代码
源码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!-- <meta name="viewport" content="width=device-width, initial-scale=1.0"> -->
<title>调色盘</title>
<style>
#colorDisplay {
width: 200px;
height: 200px;
margin: 20px;
}
body {
background-color: #eee;
}
</style>
</head>
<body>
<h2>调色盘</h2>
<p>当前颜色: RGB(<span id="redValue">0</span>, <span id="greenValue">0</span>, <span id="blueValue">0</span>)</p>
<label for="red">红色:</label>
<input type="range" id="red" min="0" max="255" value="0" oninput="updateColor()">
<label for="green">绿色:</label>
<input type="range" id="green" min="0" max="255" value="0" oninput="updateColor()">
<label for="blue">蓝色:</label>
<input type="range" id="blue" min="0" max="255" value="0