Skip to content

Add save html#47

Open
Kiwigamer wants to merge 2 commits into
TheZoraiz:masterfrom
Kiwigamer:add-save-html
Open

Add save html#47
Kiwigamer wants to merge 2 commits into
TheZoraiz:masterfrom
Kiwigamer:add-save-html

Conversation

@Kiwigamer

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown

@TheZoraiz Friendly bump here. This would be very useful

@TheZoraiz

Copy link
Copy Markdown
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
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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