diff --git a/boards/models/post/__init__.py b/boards/models/post/__init__.py --- a/boards/models/post/__init__.py +++ b/boards/models/post/__init__.py @@ -443,5 +443,15 @@ class Post(models.Model, Viewable): def get_tripcode_color(self): return self.tripcode[:6] + def get_tripcode_background(self): + code = self.get_tripcode_color() + result = '' + + for i in range(0, len(code), 2): + p = code[i:i+2] + result += hex(255 - int(p, 16))[2:] + + return result + def get_short_tripcode(self): return self.tripcode[:10] \ No newline at end of file diff --git a/boards/templates/boards/post.html b/boards/templates/boards/post.html --- a/boards/templates/boards/post.html +++ b/boards/templates/boards/post.html @@ -9,7 +9,7 @@ {{ post.title }} {% if post.tripcode %} - {{ post.get_short_tripcode }} + {{ post.get_short_tripcode }} {% endif %} {% comment %} Thread death time needs to be shown only if the thread is alredy archived