aboutsummaryrefslogtreecommitdiff
path: root/aoc2023/build/packages/gleam_community_ansi/README.md
diff options
context:
space:
mode:
authorJ.J <thechairman@thechairman.info>2024-05-30 21:50:02 -0400
committerJ.J <thechairman@thechairman.info>2024-05-30 21:50:02 -0400
commit612fd986ab1e00b6d34dc1937136250e08e89325 (patch)
treea3c93952040c6afdf348b5831619a45db7ba0a2e /aoc2023/build/packages/gleam_community_ansi/README.md
parent231c2b688d1e6cf0846d46e883da30e042a9c6cf (diff)
downloadgleam_aoc-612fd986ab1e00b6d34dc1937136250e08e89325.tar.gz
gleam_aoc-612fd986ab1e00b6d34dc1937136250e08e89325.zip
cleanup
Diffstat (limited to 'aoc2023/build/packages/gleam_community_ansi/README.md')
-rw-r--r--aoc2023/build/packages/gleam_community_ansi/README.md72
1 files changed, 72 insertions, 0 deletions
diff --git a/aoc2023/build/packages/gleam_community_ansi/README.md b/aoc2023/build/packages/gleam_community_ansi/README.md
new file mode 100644
index 0000000..90ab0d5
--- /dev/null
+++ b/aoc2023/build/packages/gleam_community_ansi/README.md
@@ -0,0 +1,72 @@
+# gleam-community/ansi
+
+Format text with ANSI escape sequences.
+
+[![Package Version](https://img.shields.io/hexpm/v/gleam_community_ansi)](https://hex.pm/packages/gleam_community_ansi)
+[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/gleam_community_ansi/)
+
+✨ This project is written in _pure Gleam_ so you can use it anywhere Gleam runs:
+Erlang, Elixir, Node, Deno, even [some browsers](https://bit.ly/devtools-console-ansi-support)!
+
+---
+
+## Quickstart
+
+```gleam
+import gleam/io
+import gleam_community/ansi
+
+pub fn main() {
+ let greeting = "Hello, " <> ansi.pink("world") <> "!"
+
+ greeting
+ |> ansi.bg_white
+ |> io.println
+}
+
+```
+
+## Installation
+
+`gleam_community` packages are published to [hex.pm](https://hex.pm/packages/gleam_community_ansi)
+with the prefix `gleam_community_`. You can add them to your Gleam projects directly:
+
+```sh
+gleam add gleam_community_ansi
+```
+
+The docs can be found over at [hexdocs.pm](https://hexdocs.pm/gleam_community_ansi).
+
+## ANSI-what?
+
+ANSI escape sequences date back to the 70s as a standard way to format text on
+various video text terminals. Since then they have been adopted by many software
+terminal emulators and platforms, including some Web browsers, and are a simple
+way to format text without platform-specific APIs.
+
+The point of this package is to abstract the specific codes away and give you an
+easy-to-understand API for formatting and colouring terminal text. Still, here is
+a quick couple of examples of what's happening under the hood.
+
+You can copy these examples straight into your terminal to see them in action!
+
+- Colour text yellow:
+
+ ```shell
+ $ echo "\e[33mhello"
+ ```
+
+- Colour the background pink:
+
+ ```shell
+ $ echo "\e[45mhello"
+ ```
+
+- Render text italic:
+
+ ```shell
+ $ echo "\e[3mhello\e[23m"
+ ```
+
+As you can see, the escape sequences are a bit obscure. Sure, you could hard code
+them, or you could use this package!