Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shuoGG1239/ColorCatcher
取色器
https://github.com/shuoGG1239/ColorCatcher
Last synced: 3 months ago
JSON representation
取色器
- Host: GitHub
- URL: https://github.com/shuoGG1239/ColorCatcher
- Owner: shuoGG1239
- Created: 2019-06-03T13:07:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-06-09T06:50:49.000Z (over 5 years ago)
- Last Synced: 2024-07-31T21:53:50.504Z (5 months ago)
- Language: Python
- Size: 8.79 KB
- Stars: 5
- Watchers: 0
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-qt - ColorCatcher
README
## 简单的拾色器
* 最近遇到几次取屏幕某处颜色的场景, 用ps去取色又觉得有点麻烦(步骤太多我懒), 索性自己做一个简单的拾色器
* 功能极简单就是取屏幕某处的色号, 按下空格把颜色记录下来...## 效果
![colorcatcher.gif](https://i.loli.net/2019/06/09/5cfc9e5a216b517905.gif)## 思路
* 定时截取屏幕然后取下鼠标位置的像素颜色
```python
def catch(self):
x = QCursor.pos().x()
y = QCursor.pos().y()
pixmap = QGuiApplication.primaryScreen().grabWindow(QApplication.desktop().winId(), x, y, 1, 1)
if not pixmap.isNull():
image = pixmap.toImage()
if not image.isNull():
if (image.valid(0, 0)):
color = QColor(image.pixel(0, 0))
r, g, b, _ = color.getRgb()
self.nowColor = color
self.ui.lineEditMove.setText('(%d, %d, %d) %s' % (r, g, b, color.name().upper()))
self.ui.lineEditMove.setStyleSheet('QLineEdit{border:2px solid %s;}' % (color.name()))```
## 依赖
* PyQt5## 代码
* [https://github.com/shuoGG1239/ColorCatcher](https://github.com/shuoGG1239/ColorCatcher)