Giter Club home page Giter Club logo

colorcatcher's Introduction

简单的拾色器

  • 最近遇到几次取屏幕某处颜色的场景, 用ps去取色又觉得有点麻烦(步骤太多我懒), 索性自己做一个简单的拾色器
  • 功能极简单就是取屏幕某处的色号, 按下空格把颜色记录下来...

效果

colorcatcher.gif

思路

  • 定时截取屏幕然后取下鼠标位置的像素颜色
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

代码

colorcatcher's People

Contributors

shuogg1239 avatar

Stargazers

Zhouliang Cai avatar 了空 avatar  avatar QingHao avatar lukou3 avatar

colorcatcher's Issues

请教

你好,这个支持linux系统和mac系统吗

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.