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

Add save html #47

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add save html #47

wants to merge 2 commits into from

Conversation

Kiwigamer
Copy link

What kind of change dose this PR introduce?

Adding the '--save-html' flag.

What is this used for?

Users can now save ascii-art as a html file. To further copy text with colored data.

Why is it important?

Colored ascii-art can not be copied from the terminal including the colored data. Furthermore txt files can not save color. By introducing the html save useres can open the generated html file and copy the ascii-art including its text color.

@TheZoraiz
Copy link
Owner

This looks great. I'll test and review this in detail soon. I appreciate you actually making the change instead of opening an issue :)

@themichaelusa
Copy link

@TheZoraiz Friendly bump here. This would be very useful

@TheZoraiz
Copy link
Owner

Apologies for the delay. Some personal stuff has been getting in the way lately. I'll get on this as soon as I can

@themichaelusa
Copy link

@TheZoraiz Sounds good, and thank you

"<span style=\"color:rgb(%d,%d,%d)\">%s</span>",
rgb[0], rgb[1], rgb[2], asciiChar.Simple,
))
} else {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check for and apply fontColor flag/global variable as well. You can check it's existing implementation at aic_package/util.go line 105

}

// If path exists
if _, err := os.Stat(saveHtmlPath); !os.IsNotExist(err) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can reuse getFullSavePath() function to check and retrieve save path

@TheZoraiz
Copy link
Owner

Hello @Kiwigamer. Really sorry for the late response. I haven't been active in this project for a long time. I guess it's time to change that 😅

I do think an html implementation should utilize the <canvas> element for greater flexibility, but we can have that discussion at a later date. Plus, copy pasting a canvas implementation wouldn't be straight forward, which I'm imagining is the highlight behind this feature. We'll deploy this as it is for now.

Otherwise, your code looks good. I've added some comments for minor tweaks and we should be good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants