From 34c95546b7ee52b5a69b26c8d400789aae0248ee Mon Sep 17 00:00:00 2001 From: Pete Davison Date: Sun, 4 Aug 2024 13:18:07 +0000 Subject: [PATCH] fix: readme svg --- README.md | 89 +++++++++++++++++++++++++-------------------------- go.sum | 0 res/ansi.svg | 41 ++++++++++++++++++++++++ res/title.svg | 43 +++++++++++++++++++++++++ 4 files changed, 128 insertions(+), 45 deletions(-) delete mode 100644 go.sum create mode 100644 res/ansi.svg create mode 100644 res/title.svg diff --git a/README.md b/README.md index 6c27db9..b1c0008 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ -

-\x1b[1;43mANSI\x1b[0m -

+
+ Click to see the source +
-

-A simple, lightweight Golang package for working with ANSI escape codes. +

+ A simple, lightweight Golang package for working with ANSI escape codes.

+
If you've ever worked on a CLI application before, you probably know the struggle of working with ANSI escape codes. Often, you just want to quickly @@ -18,9 +19,7 @@ dependencies :package: It allows you to quickly apply styles to strings using need to call a function for each style, making it easy to apply/reset multiple styles to a single string. -With `ansi`, the mess at the top of this page becomes: -[bold:bg-yellow]ANSI[/] - +With `ansi`, the mess at the top of this page becomes: Click to see the source ## Usage @@ -66,20 +65,20 @@ For more info, check out the [style reference](#style-reference) below or take a ### Formatting -| Code | ANSI Code | Example | -| -------------- | --------: | ------------------------------------------------------------------------------------------------------------- | -| `bold` | `1` | Sets the font weight to bold | -| `faint`, `dim` | `2` | Sets the text brightness to its faint/dim variant \* | -| `italic` | `3` | Sets the font style to italic | -| `underline` | `4` | Sets the text decoration to underline | -| `blink` | `5` | Sets the text to blink in and out | -| `invert` | `7` | Inverts the foreground and background colors | -| `hidden` | `8` | Sets the text to be hidden | -| `strike` | `9` | Sets the text decoration to line-through | +| Code | ANSI Code | Description | +| -------------- | --------: | ---------------------------------------------------- | +| `bold` | `1` | Sets the font weight to bold | +| `faint`, `dim` | `2` | Sets the text brightness to its faint/dim variant \* | +| `italic` | `3` | Sets the font style to italic | +| `underline` | `4` | Sets the text decoration to underline | +| `blink` | `5` | Sets the text to blink in and out | +| `invert` | `7` | Inverts the foreground and background colors | +| `hidden` | `8` | Sets the text to be hidden | +| `strike` | `9` | Sets the text decoration to line-through | > \* `faint` and `dim` do not work when using 8-bit (256) or 24-bit (RGB) color modes. -| Code | ANSI Code | Example | +| Code | ANSI Code | Description | | ---------------- | --------: | --------------------------------------- | | `/bold` | `22` | Resets the font weight \*\* | | `/faint`, `/dim` | `22` | Resets the text brightness \*\* | @@ -95,35 +94,35 @@ For more info, check out the [style reference](#style-reference) below or take a ### Foreground Colors -| Code | ANSI Code | Reset Code | -| --------- | -----------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `black` | `30` | Sets the text foreground to black | -| `red` | `31` | Sets the text foreground to red | -| `green` | `32` | Sets the text foreground to green | -| `yellow` | `33` | Sets the text foreground to yellow | -| `blue` | `34` | Sets the text foreground to blue | -| `magenta` | `35` | Sets the text foreground to magenta | -| `cyan` | `36` | Sets the text foreground to cyan | -| `white` | `37` | Sets the text foreground to white | -| `R,G,B` | `38;2;R;G;B` | Sets the text foreground to the given [24-bit (RGB) color][24-bit] | -| `N` | `38;5;N` | Sets the text foreground to the given [8-bit (256) color][8-bit] | -| `/fg` | `39` | Resets the text foreground to the default color | +| Code | ANSI Code | Description | +| --------- | -----------: | ------------------------------------------------------------------ | +| `black` | `30` | Sets the text foreground to black | +| `red` | `31` | Sets the text foreground to red | +| `green` | `32` | Sets the text foreground to green | +| `yellow` | `33` | Sets the text foreground to yellow | +| `blue` | `34` | Sets the text foreground to blue | +| `magenta` | `35` | Sets the text foreground to magenta | +| `cyan` | `36` | Sets the text foreground to cyan | +| `white` | `37` | Sets the text foreground to white | +| `R,G,B` | `38;2;R;G;B` | Sets the text foreground to the given [24-bit (RGB) color][24-bit] | +| `N` | `38;5;N` | Sets the text foreground to the given [8-bit (256) color][8-bit] | +| `/fg` | `39` | Resets the text foreground to the default color | ### Background Colors -| Code | ANSI Code | Reset Code | -| ------------ | -----------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `bg-black` | `40` | Sets the text background to black | -| `bg-red` | `41` | Sets the text background to red | -| `bg-green` | `42` | Sets the text background to green | -| `bg-yellow` | `43` | Sets the text background to yellow | -| `bg-blue` | `44` | Sets the text background to blue | -| `bg-magenta` | `45` | Sets the text background to magenta | -| `bg-cyan` | `46` | Sets the text background to cyan | -| `bg-white` | `47` | Sets the text background to white | -| `bg-R,G,B` | `48;2;R;G;B` | Sets the text background to the given [24-bit (RGB) color][24-bit] | -| `bg-N` | `48;5;N` | Sets the text background to the given [8-bit (256) color][8-bit] | -| `/bg` | `49` | Resets the text background to the default color | +| Code | ANSI Code | Description | +| ------------ | -----------: | ------------------------------------------------------------------ | +| `bg-black` | `40` | Sets the text background to black | +| `bg-red` | `41` | Sets the text background to red | +| `bg-green` | `42` | Sets the text background to green | +| `bg-yellow` | `43` | Sets the text background to yellow | +| `bg-blue` | `44` | Sets the text background to blue | +| `bg-magenta` | `45` | Sets the text background to magenta | +| `bg-cyan` | `46` | Sets the text background to cyan | +| `bg-white` | `47` | Sets the text background to white | +| `bg-R,G,B` | `48;2;R;G;B` | Sets the text background to the given [24-bit (RGB) color][24-bit] | +| `bg-N` | `48;5;N` | Sets the text background to the given [8-bit (256) color][8-bit] | +| `/bg` | `49` | Resets the text background to the default color | [8-bit]: https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit [24-bit]: https://en.wikipedia.org/wiki/ANSI_escape_code#24-bit diff --git a/go.sum b/go.sum deleted file mode 100644 index e69de29..0000000 diff --git a/res/ansi.svg b/res/ansi.svg new file mode 100644 index 0000000..f634959 --- /dev/null +++ b/res/ansi.svg @@ -0,0 +1,41 @@ + + +
+ + + + [bold:bg-yellow]ANSI[/] + +
+
+
diff --git a/res/title.svg b/res/title.svg new file mode 100644 index 0000000..92b8c9e --- /dev/null +++ b/res/title.svg @@ -0,0 +1,43 @@ + + +
+ + +

+ \x1b[1;43mANSI\x1b[0m +

+
+
+