Fix issue and disable choosing box color

This commit is contained in:
tzutalin
2017-10-24 11:26:42 +08:00
parent 6cf04adfa5
commit 2e525f8ab2
3 changed files with 9 additions and 33 deletions
+5 -17
View File
@@ -74,20 +74,8 @@ def fmtShortcut(text):
def generateColorByText(text):
color_table = []
color_table.append(QColor(0, 0, 50))
color_table.append(QColor(0, 0, 255))
color_table.append(QColor(0, 50, 0))
color_table.append(QColor(0, 255, 0))
color_table.append(QColor(50, 0, 0))
color_table.append(QColor(255, 0, 0))
color_table.append(QColor(0, 50, 50))
color_table.append(QColor(0, 255, 255))
color_table.append(QColor(50, 50, 0))
color_table.append(QColor(255, 255, 0))
color_table.append(QColor(50, 0, 50))
color_table.append(QColor(255, 0, 255))
color_table.append(QColor(50, 50, 50))
color_table.append(QColor(255, 255, 255))
colorInd = int(hashlib.sha1(text.encode('utf-8')).hexdigest(), 16) % len(color_table)
return color_table[colorInd]
hashCode = hash(text)
r = int((hashCode / 255) % 255)
g = int((hashCode / 65025) % 255)
b = int((hashCode / 16581375) % 255)
return QColor(r, g, b, 100)