Hello there! A few months back, I made a Rust crate called Farben. It started small but then became something I truly like.
After that, I tried programming in Odin and I really loved it. Because of that, I wanted to try rewriting my library in Odin.
After a few days, I finally got it working. Odin has made making this very easy and straightforward, love the language.
Introducing ofarben, a terminal coloring package built around a lightweight markup syntax.
ofarben.cprintfln("[bold red]Error:[/] something went wrong.")
ofarben.cprintfln("[green]Success:[/] operation completed.")
ofarben.cprintfln("[rgb(255,100,0)]Custom color[/]")
The features that currently work:
- Named colors, RGB, ANSI256, and hex (
#ff0000,#f00) - Bold, italic, underline, strikethrough, and more
- Partial resets (
[/red]) removes just the red and keeps everything else - Style bleeding across calls with
reset = false - TTY/env detection, respects
NO_COLOR,CLICOLOR_FORCE, etc. - Color degradation, automatically downgrades RGB to ANSI256 to 16 colors to nothing based on terminal support
- Got a little too much fun making this one: compiler-quality diagnostic errors that I tried to make look like Odin’s compiler errors.
core:fmt-mirrored API just with acprefix:cprintfln,ctprintf,cwprintf,caprintf, and more
Codeberg: https://codeberg.org/razkar/ofarben
GitHub mirror: https://github.com/razkar-studio/ofarben
What are your thoughts about it? Let me know. Especially something about:
- How does the syntax feel to use?
- Anything unintuitive?
- Any features you want to add in the future?
- Anything I didn’t cover here that you wanted to ask about?