ansi
Version, currently main branch1 version
- main branchlatestFeb 23, 2026
github.com/dsisnero/ansi
Port of golang ansi library
0 stars
4 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
ansi:
github: dsisnero/ansi
branch: mainmain is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
>= 1.19.1- License
- MIT
- Author
- your-name-here <your-email-here>
Dependencies
Runtime Dependencies
- colorful*github: dsisnero/colorful
- uniwidth*github: naqvis/uni_char_width
- stumpy_png~> 5.0github: stumpycr/stumpy_png
Development Dependencies
- ameba~> 1.0github: crystal-ameba/amebadev
README
ansi
ansi is a Crystal library for generating and parsing ANSI terminal escape
sequences. It is a Crystal port of x/ansi (Go) and includes helpers for
colors, styles, cursor control, modes, mouse/keyboard protocols, images
(Kitty, iTerm2, Sixel), and sequence parsing/decoding utilities.
Installation
-
Add the dependency to your
shard.yml:dependencies: ansi: github: dsisnero/ansi -
Run
shards install
Usage
require "ansi"
Examples:
# Colors and styles
puts Ansi.sgr(Ansi::AttrBold, Ansi::AttrBlueForegroundColor) + "Hello" + Ansi::ResetStyle
# Cursor movement
print Ansi.cursor_up(2)
print Ansi.cursor_forward(10)
# Clipboard
print Ansi.set_system_clipboard("hello")
# Kitty graphics
payload = "...".to_slice
print Ansi.kitty_graphics(payload)
Development
Run specs:
crystal spec
Contributing
- Fork it (https://github.com/dsisnero/ansi/fork)
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
Contributors
- your-name-here - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
main- Seen
- Feb 23, 2026
- Crystal
>= 1.19.1- Indexed
- yes
Dependents
Repository
github.com/dsisnero/ansi
Metadata
- Created
- Aug 19, 2026
- Updated
- Sep 17, 2026
- Synced
- Sep 17, 2026
- Versions
- 1