Comments (3)
I'm able to replicate this. It happens with any piping.
For example:
$ asciiart -c flanders.jpg
<COLOR ART HERE>
$ asciiart -c flanders.jpg | grep =
<white "="s here>
It's been a LOOONNNNNGGG time since this gem has gotten any attention so thanks for the issue.
I'm not proud of some of this code but....
-c (with text output relies on the rainbow gem (v 2.0.0).
I see Rainbow has been updated to 3.0.0 since I originally wrote asciiart and maybe they're aware of it...or maybe it's a limitation of colored output? I'm no expect but I made a small test using Rainbow 2.0.0
#rainbowtext.rb
require 'rainbow'
require 'rainbow/ext/string'
puts "Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis ".color(:yellow)
$ ruby rainbowtest.rb
<YELLOW TEXT HERE>
$ ruby rainbowtest.rb | grep m
<white m's here>
When I have some freetime - I can experiment with newer versions of Rainbow, but if you have a moment you could try it to? The exact line is here.
You'd need to:
- Bump the gemspec to newer version of Rainbow
- Use newer syntax if needed.
from asciiart.
Thanks, Stephen!
I had a look inside rainbow.rb. It contains this line:
self.enabled = true if ENV['CLICOLOR_FORCE'] == '1'
Therefore, this works as intended:
CLICOLOR_FORCE=1 asciiart -c imagefile.png | less -R
:)
EDIT: Furthermore, it seems that this is the main way to get rainbow to behave in this way. So while there's no programmatic fix per se, maybe an update to the manpage to point this out might be useful to future users :)
from asciiart.
For sure - this has been a fun introduction (for me at least) about how color is managed in terminals. I've created #9 and will take a swing at it!
EDIT: Thanks for doing the footwork in rainbows @tpapastylianou !
from asciiart.
Related Issues (9)
- No Ability To Change Ascii Art Size... HOT 2
- Issue with Gem Installation HOT 7
- Manpages for asciiart. Available
- Support other transformation character sets HOT 2
- License missing from gemspec
- undefined method `color' for " ":String HOT 2
- Deprecated requirement HOT 3
- Add Example of preserving color with piping to README
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asciiart.