Colorize Filter

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from django import template
register = template.Library()

def do_colorize(value):
    if not value:
        return ''
    
    result = sum([ord(c) for c in value])
    return "#%X" % result

register.filter('colorize', do_colorize)

More like this

  1. HTML color code field by b23 5 years, 9 months ago
  2. HTML Hex Color Field by claudelacey 4 years, 11 months ago
  3. Pygmentation by alcides 5 years, 10 months ago
  4. Django template tag to hash/map a value to a unique web color. by danielsokolowski 2 years, 5 months ago
  5. sorl.thumbnail processor: white background by izibi 5 years, 8 months ago

Comments

(Forgotten your password?)