juliadocs / ansicoloredprinters.jl Goto Github PK
View Code? Open in Web Editor NEWANSI escape code translator
License: MIT License
ANSI escape code translator
License: MIT License
Currently 216 of the 256 colors use web-safe colors, but the major terminal software seems to use a different scale.
id | Web-Safe | Xterm |
---|---|---|
16 | #000000 | #000000 |
17 | #000033 | #00005f |
18 | #000066 | #000087 |
19 | #000099 | #0000af |
20 | #0000cc | #0000d7 |
21 | #0000ff | #0000ff |
FYI, ImageInTerminal.jl uses equal stepping, as does web-safe colors.
https://github.com/JuliaImages/ImageInTerminal.jl/blob/93ed0c35cd0180722cf7e2f07e99b4356dba7f09/src/colorant2ansi.jl#L44-L45
cf. JuliaDocs/Documenter.jl#1945
Perhaps code refactoring and adding comments to the source code before the implementation would be a good idea.
@tecosaur mentioned the issue of OSC8 links in JuliaDocs/Documenter.jl#2487
Hyperlinks (a.k.a. HTML-like anchors) in terminal emulators
https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
I don't have an MRE for the error. However, since osc8 links has become the de facto standard, it seems worth supporting it.
Although converting "text/plain" to "text/plain" may seem unnecessary, there are two use cases.
One is stripping ANSI escape codes. You can do this by printing in the context of :color => false
.
The other is to optimize ANSI escape code. For example, using printstyled
inserts redundant code because it restores to normal state each call, and it doesn't support the sequential semicolon notation (e.g. "\e[1;31;9m").
This package is not yet mature, but I would like to register the package early for experimental use e.g. in JuliaDocs/Documenter.jl#1441. For the time being, it will be developed as v0.1.x even with "minor" breaking changes.
If you have anything to be discussed before registering the package, please comment here or in #4.
As suggested in JuliaDocs/Documenter.jl#1441 (review)
BTW, I don't care about the default branch name, so I just use the default name. As a result, this repository uses the "main". If you prefer "master", you can change the name.
This package was originally a refactored version of the utility code from another developing package. I have no clear pictures of its future as a stand-alone package.
I plan to add at least a PlainTextPrinter
for "text/plain" output in the future (cf. issue #6, PR #12), and I don't intend to make this package for HTML-only. SVGPrinter
may be useful, although it has some difficulties in automatic text layout compared to HTML. Also, to implement LaTeXPrinter
needs helps.
This is why I intentionally didn't include "HTML" in the package name, but I also don't think the current package name is appropriate. The reason why the name is not AnsiColorPrinters.jl
is that the coloring itself is done on the input side, and this package only translates the colors. In that sense, I think AnsiColorTranslators.jl
or AnsiEscapeCodeTranslators.jl
is a more suitable name. However, HTMLTranslator
is a wrong name and names like AnsiColorTranslatorHTML
are too verbose.
It is possible to define generic types such as Translator{:HTML}
or Translator{MIME"text/html"}
, by containing the format-specific options in a dictionary rather than a sequence of fields. However, in that case, there is almost no advantage to separate types for each output format in the first place. ๐
Apart from that discussion, "ANSI" is probably better than "Ansi" in terms of consistency. (Edit: Done in PR #9)
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
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.