##// END OF EJS Templates
Convert \r\n and \r to \n in the post text used in sync
Convert \r\n and \r to \n in the post text used in sync

File last commit:

r1308:ced75ab0 default
r1504:ce9e0d38 decentral
Show More
tripcode.py
26 lines | 608 B | text/x-python | PythonLexer
class Tripcode:
def __init__(self, code_str):
self.tripcode = code_str
def get_color(self):
return self.tripcode[:6]
def get_background(self):
code = self.get_color()
result = ''
for i in range(0, len(code), 2):
p = code[i:i+2]
background = hex(255 - int(p, 16))[2:]
if len(background) < 2:
background = '0' + background
result += background
return result
def get_short_text(self):
return self.tripcode[:8]
def get_full_text(self):
return self.tripcode