Fix issue and disable choosing box color
This commit is contained in:
+5
-17
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user