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

Support colors when using custom ascii image (--ascii-input option) #552

Closed
Pomroka opened this issue Dec 8, 2021 · 8 comments
Closed
Labels
bug Something isn't working feature request good first issue Good for newcomers

Comments

@Pomroka
Copy link

Pomroka commented Dec 8, 2021

Using --ascii-colors don't affect my image, only text.

image

@spenserblack
Copy link
Collaborator

Looks like an empty Vec is currently getting passed as the colors when custom ASCII art is used.

let colors: Vec<Color> = Vec::new();
let mut buf = String::new();
if self.info.config.art_off {
buf.push_str(&info_str);
} else if let Some(custom_image) = &self.info.config.image {
let image_backend = self
.info
.config
.image_backend
.as_ref()
.with_context(|| "Could not detect a supported image backend")?;
buf.push_str(
&image_backend
.add_image(
info_lines.map(|s| format!("{}{}", center_pad, s)).collect(),
custom_image,
self.info.config.image_color_resolution,
)
.with_context(|| "Error while drawing image")?,
);
} else {
let mut logo_lines = if let Some(custom_ascii) = &self.info.config.ascii_input {
AsciiArt::new(custom_ascii, &colors, !self.info.config.no_bold)

@spenserblack spenserblack added the bug Something isn't working label Dec 8, 2021
@spenserblack
Copy link
Collaborator

spenserblack commented Dec 8, 2021

In fact, the current behavior is that colors are effectively disabled when using custom ascii art.

I'll change the title to reflect that we need to make a change to support this.

(not 100% sure if this qualifies as a bug report or a feature request 🤷)

@spenserblack spenserblack changed the title How to use color in own ascii image? Support colors when using custom ascii image (--ascii-input option) Dec 8, 2021
@o2sh
Copy link
Owner

o2sh commented Dec 9, 2021

NGL, it never crossed my mind to combine the two flags --ascii-colors and --ascii-input together 😅

It shouldn't be too hard to make it work 👍

@o2sh o2sh added the good first issue Good for newcomers label Dec 9, 2021
@Pomroka
Copy link
Author

Pomroka commented Dec 10, 2021

As i didn't find a way to load custom ascii image directly i used --ascii-input and when i saw no color i try use only logical option i found.
Load custom ascii logo from file would be my another Feature Request

@spenserblack
Copy link
Collaborator

spenserblack commented Dec 10, 2021

Load custom ascii logo from file

Until that feature is implemented I think that onefetch --ascii-input "$(cat my-ascii-art-file)" would work.

@stale
Copy link

stale bot commented Mar 10, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@o2sh
Copy link
Owner

o2sh commented Jun 12, 2022

@Pomroka with #680, it should work as expected.
If you agree, don't forget to close the issue.

@Pomroka
Copy link
Author

Pomroka commented Jun 12, 2022

👍

@Pomroka Pomroka closed this as completed Jun 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants