pnathan / cl-ansi-text Goto Github PK
View Code? Open in Web Editor NEWEnables ANSI colors for printing.
Enables ANSI colors for printing.
I often see this error:
No COMMON-LISP:MAKE-LOAD-FORM method is defined for #S(CL-COLORS:RGB :RED 38/51 :GREEN 38/51 :BLUE 38/51)
Example log: http://cl-test-grid.appspot.com/blob?key=em5wzi7bnx
Many more examples can be found in this report:
https://common-lisp.net/project/cl-test-grid/ql/quicklisp-2015-06-08-diff2.html
As you see from the log, the error happens not when cl-ansi-text is compiled, but when another library depending on it is compiled, file quicklisp/dists/quicklisp/software/prove-20150113-git/src/reporter/list.lisp
Probably CCL tries to inline the gray
constant in the client code. It's difficult to reproduce, I don't know how CCL makes the decision to inline. Maybe it's even non-deterministic, on this page - http://trac.clozure.com/ccl/wiki/DeclareOptimize - we read: "If the lisp kernel profile shows a lot of time spent in _SPspecrefcheck, it might help to spend less time doing special variable references inline." Does it mean the compiler decides when to optimize depending on some profile statistics lisp kernel accumulates on runtime? I don't know.
But anyway, just from the fact that the error happens when a dependent library is compiled, I suggest to
add :load-toplevel :execute
to the eval-when
here:
cl-ansi-text/cl-ansi-text.lisp
Line 36 in f618463
README says
These are CSS-style color strings such as "#FF0000".
but it does not work.
(with-color ("#ff0000") (princ :hoge)) => error
(with-color ("ff0000") (princ :hoge)) => works
If documentation is expected one, cl-colors2:parse-hex-rgb
should be used rather than cl-colors2:hex-to-rgb
in the method RGB-COLOR-CODE
.
If current behavior is expected one, the readme should be fixed.
Add cl-test-grid support so that we can recognize when our code breaks on a certain implementation.
Regrettably, I do not know of a way to verify correct color displays from a terminal without picture-based comparisons.
https://github.com/pnathan/cl-ansi-text/runs/1273510704
It'd be nice to have that green banner again. The error is odd, something about a GC invariant being invalidated while building roswell?
Hi,
I'd like to use 4 bit bold/bright color variants. Is this possible with cl-ansi-text?
Thank you!
Current API can be improved. Imagine that we could have some style table, so you could associate a keyword with collection of parameters: color, effects, etc. Once it's done, we could use these keywords to control style of output. Even more: this should be the only one way to color output. This way you don't repeat yourself if you have to follow some consistent style through your program. Every item in such a style table can be easily edited that will result in different rendering of all text that uses this style.
More interesting functions may be added. For example, something that sets fill-column, although it's nothing to do with ANSI terminals.
It's interesting what you can say about these ideas, because I see that your library is not bad. If you don't want to include these features, I will write my own library that is based on the idea of style-sheets.
https://twitter.com/jschauma/status/309781450398507010
"Unix tool writers: it'd be swell if you could not print ^[[0;33color code^[[0m escape sequences if output does not in fact go to a tty."
This indicates that a TTY-P needs to be implemented to allow library users to not output ansi-codes if they do not want to.
OSX 10.8 tty
command has this definition:
The tty utility exits 0 if the standard input is a terminal, 1 if the standard input is not a terminal, and >1 if an error occurs.
Adding external-program
as a dependency and invoking tty
should gather the requisite information.
Referencing PR #8 and @xach 's comment d9b1ea3#r36624741
@guicho271828 - FYI.
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.