rubyworks / ansi Goto Github PK
View Code? Open in Web Editor NEWSet of ANSI Code based classes and modules for Ruby
Home Page: https://rubyworks.github.com/ansi
License: BSD 2-Clause "Simplified" License
Set of ANSI Code based classes and modules for Ruby
Home Page: https://rubyworks.github.com/ansi
License: BSD 2-Clause "Simplified" License
There needs to be a way to globally deactivate ANSI coloring.
Gem::RemoteFetcher::FetchError: bad response Bad Gateway 502 (http://production.cf.rubygems.org/gems/ansi-1.4.2.gem)
An error occured while installing ansi (1.4.2), and Bundler cannot continue.
I searched through the API but couldn't figure out how to display an ANSI "normal" weight code... for instance, after bolding, going back to normal. Is this implemented?
Actual colour codes are displayed throughout the command line:
←[33m ERROR←[0m testPasswordChange (1.50s)
I did notice that the RUBY_PLATFORM check to load Win32/Console/ANSI is looking for win32 in the string but my RUBY_PLATFORM = i386-mingw32
A deactivation flag or variable that can be set disabling it for all gems that require colours would be nice.
I am on Windows XP.
When I type:
require "ansi"
ANSI::Terminal.terminal_width
I have the message: No such file or directory - stty size
In https://github.com/rubyworks/ansi/blob/master/lib/ansi/terminal.rb, the code seems to require successively ansi/terminal/stty
, ansi/terminal/curses
, ansi/terminal/termios
and ansi/terminal/win32
until one of these require does not raises.
I guess that stty
is supposed to raise on Windows, to avoid using this library. However when I require manually ansi/terminal/stty
, it does not raises.
In fact, when I read the code of ansi/terminal/stty
I do not see anything that can raise on Windows (or on any platform).
Take a look at the Term::ANSIColor and Colored gems:
Maybe we can make ANSI's API compatible so that it can act as a drop-in replacement.
When running rake test and using minitest I get the following error:
/usr/local/rvm/gems/[email protected]/gems/ansi-1.4.3/lib/ansi/chart.rb:26: warning: duplicated key at line 29 ignored: :concealed
First the issue, even with win32console I can't get colors on windows:
irb(main):001:0> require 'ansi/code'
ansi: 'gem install win32console' to use color on Windows
The reason is that win32console is deprecated (and does not load on recent ruby versions). The good news is that, to the best of the my knowledge, it is no longer needed in ruby 2.0+.
The fix is very simple: don't require 'win32console' when ruby version is 2.0+ (assuming I am not missing anything here).
I verified this by changing code.rb, line 9 to:
if RUBY_PLATFORM =~ /(win32|w32)/ && RUBY_VERSION < "2.0"
This seems to work fine for me.
puts ANSI.yellow{ "Foo" + ANSI.invert{ "∙∙∙" } + "bar" }
You can see the bar
at the end isn't yellow, but you'd expect it to be. I'm using invert
to make whitespace visible in a text based game.
The actual output is:
"\e[33mFoo\e[7m∙∙∙\e[0mbar\e[0m"
Expected:
- "\e[33mFoo\e[7m∙∙∙\e[0mbar\e[0m"
+ "\e[33mFoo\e[7m∙∙∙\e[27mbar\e[0m"
Now that ANSI::Diff is in the picture, the class is going to need an an alternate non-color version for when color needs to be turned off.
I figure rather than colors use underlining with "=" and "-" and maybe "^".
Allow String#ansi to take Integer and convert to ANSI command.
Hi guys,
Just wanted to give you a hat tip for a well written Notice file with all of the contained licenses.
Only change required is Highline's homepage moved to https://github.com/JEG2/highline.
All the best
Please add some info the the readme on how to do this, standard would be bundle && bundle exec rake
but that does not work...
Why are all these methods broken?
> ANSI::Code.hex '000000'
NoMethodError: undefined method `rgb_value` for ANSI::Code:Module
> ANSI::Code.rgb(0,255,0)
NoMethodError: undefined method `rgb_value` for ANSI::Code:Module
> ANSI::Code.rgb_256(0,255,0)
NoMethodError: private method `rgb_256` called for ANSI::Code:Module
> ANSI::Code.send(:rgb_256, 0,255,0)
NoMethodError: undefined method `rgb_valid` for ANSI::Code:Module
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.