Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom bg fg colors and css #203

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

CommanderPho
Copy link

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.

…to Ansi2HTMLConverter to enable specifying custom background/foreground colors and css properties
@ssbarnea
Copy link
Member

@CommanderPho Can you please rebase?

@ralphbean ralphbean removed their request for review February 5, 2024 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants