Skip to content

New option "--fillonly" - #56

Merged
wader merged 4 commits into
wader:masterfrom
EvilJordan:master
Dec 15, 2025
Merged

wader merged 4 commits into
wader:masterfrom
EvilJordan:master

Conversation

@EvilJordan

Copy link
Copy Markdown
Contributor

New option --fillonly will remove stroke from generated SVGs and only use fill for colors.

Defaults to false, so no change in output unless invoked.

Comment thread README.md Outdated
@wader

wader commented Dec 14, 2025

Copy link
Copy Markdown
Owner

Would it work to put conditional around the foreground sections in the template? unless you want to keep the text but "invisible" for some reason?

@wader

wader commented Dec 14, 2025

Copy link
Copy Markdown
Owner

Some test could be nice also? the current tests seem to fail because of indent different so they might need to be updated to also, see https://github.com/wader/ansisvg?tab=readme-ov-file#development-and-release-build

@EvilJordan

Copy link
Copy Markdown
Contributor Author

Would it work to put conditional around the foreground sections in the template? unless you want to keep the text but "invisible" for some reason?

I'm not sure what you mean? Text still works fine with --fillonly.

@wader

wader commented Dec 15, 2025 •

Copy link
Copy Markdown
Owner

Would it work to put conditional around the foreground sections in the template? unless you want to keep the text but "invisible" for some reason?

I'm not sure what you mean? Text still works fine with --fillonly.

Doh sorry i should have tested your PR before commenting, now i think i see what it does. In what situations does background stroke cause a problem? if i remember correctly it was added because with some svg renderers would render a tiny gap between the background rects without it. Thinking it would be nice to document why such an option exist and when it one would want to use it.

Comment thread cli/cli.go Outdated
var listColorSchemesFlag = fs.Bool("listcolorschemes", false, "List color schemes")
var transparentFlag = fs.Bool("transparent", ansitosvg.DefaultOptions.Transparent, "Transparent background")
var gridModeFlag = fs.Bool("grid", false, "Grid mode (sets position for each character)")
var fillOnlyFlag = fs.Bool("fillonly", false, "Remove strokes from SVG output (use fills only)")

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.

Probably want ansitosvg.DefaultOptions.FillOnly here

Comment thread ansitosvg/ansisvg.go Outdated
MarginSize: xydim.XyDimFloat{X: 0, Y: 0},
ColorScheme: "Builtin Dark",
Transparent: false,
FillOnly: false,

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.

gofmt seem to want to indent this false a bit to align with the rest

@EvilJordan

Copy link
Copy Markdown
Contributor Author

Would it work to put conditional around the foreground sections in the template? unless you want to keep the text but "invisible" for some reason?

I'm not sure what you mean? Text still works fine with --fillonly.

Doh sorry i should have tested your PR before commenting, now i think i see what it does. In what situations does background stroke cause a problem? if i remember correctly it was added because with some svg renderers would render a tiny gap between the background rects without it. Thinking it would be nice to document why such an option exist and when it one would want to use it.

I've been using the tool to convert several ANSIs built primarily with the block character to SVGs using --grid and --charboxsize. When I pull those SVGs into Illustrator, the strokes cause overlapping on the otherwise perfectly placed blocks, and I end up having to manually edit the SVGs. I got sick of it, so I forked the code for my use and thought someone else might benefit.

@wader

wader commented Dec 15, 2025

Copy link
Copy Markdown
Owner

I've been using the tool to convert several ANSIs built primarily with the block character to SVGs using --grid and --charboxsize. When I pull those SVGs into Illustrator, the strokes cause overlapping on the otherwise perfectly placed blocks, and I end up having to manually edit the SVGs. I got sick of it, so I forked the code for my use and thought someone else might benefit.

I see, could you scribble down a few words about that under a new section in the README? "Illustrator issues" etc?

Comment thread README.md

## Illustrator Issues

When handling ANSIs primarliy composed of block characters, e.g. █, ░, ▒, etc., a `stroke` is created by default in the output SVG that may cause overlapping of characters when viewed in Illustrator. The `--fillonly` mode is provided to remove `stroke` from the output SVG. This works especially well when combined with `--grid` and `--charboxsize`.

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.

🥳 and nice catch about missing double dashes 👍

@wader
wader merged commit 45e41a3 into wader:master Dec 15, 2025
1 check passed
@wader

wader commented Dec 15, 2025

Copy link
Copy Markdown
Owner

Thanks!

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.

2 participants