open('','','width=1,height=1').document.write('<input type=color>')
点击颜色控件,点击钢笔图标,可在屏幕上取色。按空格可在圈圈中实时显示当前颜色。
当然远没有系统自带的方便~
![]() |
1
nanvon 123 天前
可以把代码加到 javascript ()内,添加到收藏夹
|
2
iMusic 123 天前
哈哈哈 简直棒呆了
|
![]() |
3
muhuan 123 天前 via iPhone
厉害
|
![]() |
4
mscststs 122 天前
```
javascript:(()=>{let d = document; let s=d.createElement("input");s.style="display:none";s.type="color";d.body.appendChild(s);s.click();s.oninput=(e)=>{navigator.clipboard.writeText(e.target.value);d.body.removeChild(s)};})(); ``` 添加到收藏夹,取色后自动拷贝到剪贴板。 仅在 Edge 上调试通过,其他浏览器不知道 |
![]() |
5
iqoo OP @mscststs 元素不用添加到文档,直接在内存里 click 就可以
let s = document.createElement('input') s.type = 'color' s.click() |
![]() |
7
mscststs 15 天前
对于 Edge > 95 和 Chrome > 95 ,亦可使用以下代码
``` javascript:(async ()=>{navigator.clipboard.writeText((await (new EyeDropper()).open()).sRGBHex);})(); ``` |