def html_style(self, fg, bg):
        """Return HTML style with WeeChat fg and bg colors."""
        weechat_basic_colors = {
            'default': 7, 'black': 0, 'darkgray': 8, 'red': 1, 'lightred': 9,
            'green': 2, 'lightgreen': 10, 'brown': 3, 'yellow': 11, 'blue': 4,
            'lightblue': 12, 'magenta': 5, 'lightmagenta': 13, 'cyan': 6,
            'lightcyan': 14, 'gray': 7, 'white': 15 }
        delim = max(fg.find(','), fg.find(':'))
        if delim > 0:
            bg = fg[delim + 1:]
            fg = fg[0:delim]
        bold = ''
        underline = ''
        reverse = False
        while fg[0] in COLOR_ATTRIBUTES:
            if fg[0] == '*':
                bold = '; font-weight: bold'
            elif fg[0] == '_':
                underline = '; text-decoration: underline'
            elif fg[0] == '!':
                reverse = True
            fg = fg[1:]
        while bg[0] in COLOR_ATTRIBUTES:
            bg = bg[1:]
        if fg == 'default':
            fg = self.options['fg']
        if bg == 'default':
            bg = self.options['bg']
        if bold and fg in ('black', '0'):
            fg = 'darkgray'
            reverse = ''
        if reverse:
            fg2 = bg
            bg = fg
            fg = fg2
        if fg == 'white' and self.whitebg:
            fg = 'black'
        num_fg = 0
        num_bg = 0
        if fg in weechat_basic_colors:
            num_fg = weechat_basic_colors[fg]
        else:
            try:
                num_fg = int(fg)
            except:
                self.prnt('Warning: unknown fg color "%s", using "default" instead' % fg)
                num_fg = weechat_basic_colors['default']
        if bg in weechat_basic_colors:
            num_bg = weechat_basic_colors[bg]
        else:
            try:
                num_bg = int(bg)
            except:
                self.prnt('Warning: unknown bg color "%s", using "default" instead' % bg)
                num_bg = weechat_basic_colors['default']
        style = 'color: #%s; background-color: #%s%s%s' % (self.html_color(num_fg),
                                                           self.html_color(num_bg),
                                                           bold, underline)
        return style