示例#1
0
    def initUI(self):
        col = QColor(0, 0, 0)

        self.btn = QPushButton("Dialog", self)
        self.btn.move(20, 20)

        self.btn.clicked.connect(self.showDialog)

        self.frm = QFrame(self)
        self.frm.setStyleSheet("QWidget {background-color: %s}" % col.name())
        self.frm.setGeometry(130, 22, 100, 100)

        self.setGeometry(300, 300, 250, 180)
        self.setWindowTitle("Color dialog")
示例#2
0
文件: utils.py 项目: ongyx/tankobon
def is_dark(color: QColor) -> bool:
    hex_color = color.name().lstrip("#")
    colors = [int(hex_color[i:i + 2], 16) for i in (0, 2, 4)]
    return [color < 0x7F for color in colors].count(True) >= 2
示例#3
0
 def setColor(self, color: QtGui.QColor):
     self.m_color = color
     self.m_frame.setStyleSheet("background-color: %s" % color.name())