ansi2html
ansi2html copied to clipboard
Custom bg fg colors and css
I added custom_bg, custom_fg, and custom_content_css_dict parameters to Ansi2HTMLConverter to enable specifying custom background/foreground colors and css properties because I needed this functionality in my own project.
I believe this also satisfies the feature request mentioned here: #153
I've never used the CLI interface, so hopefully these properties don't interfere with that functionality (which I haven't tested or looked in to).
# Example with Custom CSS Overrides:
custom_css_content_dict = {'font-family':'"Lucida Console", "Courier New", monospace', 'font-size':'8px'} # produces css like: 'font-family: "Lucida Console", "Courier New", monospace; font-size: 8px;'
conv = Ansi2HTMLConverter(custom_bg='#FFFFFF', custom_fg='#220000', custom_content_css_dict=custom_css_content_dict)
ansi = " ".join(sys.stdin.readlines())
html = conv.convert(ansi)
Hope it's helpful to someone.
@CommanderPho Can you please rebase?