def html_nick(self, nicks, index, prefix, usecolor, highlight, maxlen, optfg='fg', optbg='bg'):
        """Print a nick."""
        nick = nicks[index]
        nickfg = optfg
        if usecolor and optfg != 'weechat.color.nicklist_away':
            nick_colors = self.options['weechat.color.chat_nick_colors'].split(',')
            nickfg = nick_colors[index % len(nick_colors)]
        if usecolor and nick == self.html_nick_self:
            nickfg = 'weechat.color.chat_nick_self'
        if nick[0] in ('@', '%', '+'):
            color = self.nick_prefix_color(nick[0]) or optfg
            str_prefix = self.html_string(nick[0], 1, color, optbg)
            nick = nick[1:]
        else:
            str_prefix = self.html_string(' ', 1, optfg, optbg)
        length = 1 + len(nick)
        if not prefix:
            str_prefix = ''
            maxlen += 1
            length -= 1
        padding = ''
        if length < abs(maxlen):
            padding = self.html_string('', abs(maxlen) - length, optfg, optbg)
        if highlight:
            nickfg = 'weechat.color.chat_highlight'
            optbg = 'weechat.color.chat_highlight_bg'
        string = str_prefix + self.html_string(nick, 0, nickfg, optbg)
        if maxlen < 0:
            return padding + string
        return string + padding