Skip to content

Commit f7ed2ef

Browse files
author
morikuni
committed
Add checkansi
1 parent 447313d commit f7ed2ef

File tree

3 files changed

+69
-2
lines changed

3 files changed

+69
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ go get github.com/morikuni/aec
1313
## Features
1414

1515
ANSI escape codes depend on terminal environment.
16-
Some of these features may not work.
16+
Some of these features may not work.
17+
Check supported Font-Style/Font-Color features with [checkansi](./checkansi).
1718

18-
Check [Wikipedia](https://en.wikipedia.org/wiki/ANSI_escape_code) for more detail.
19+
[Wikipedia](https://en.wikipedia.org/wiki/ANSI_escape_code) for more detail.
1920

2021
### Cursor
2122

checkansi/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# checkansi
2+
3+
## Usage
4+
5+
```bash
6+
go run checkansi/main.go
7+
```
8+
9+
or install
10+
11+
```bash
12+
go install github.com/morikuni/aec/checkansi
13+
```

checkansi/main.go

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/morikuni/aec"
7+
)
8+
9+
func main() {
10+
fmt.Printf("%13s %s\n", "black", aec.BlackB.Apply(" "))
11+
fmt.Printf("%13s %s\n", "red", aec.RedB.Apply(" "))
12+
fmt.Printf("%13s %s\n", "green", aec.GreenB.Apply(" "))
13+
fmt.Printf("%13s %s\n", "yellow", aec.YellowB.Apply(" "))
14+
fmt.Printf("%13s %s\n", "blue", aec.BlueB.Apply(" "))
15+
fmt.Printf("%13s %s\n", "magenta", aec.MagentaB.Apply(" "))
16+
fmt.Printf("%13s %s\n", "cyan", aec.CyanB.Apply(" "))
17+
fmt.Printf("%13s %s\n", "white", aec.WhiteB.Apply(" "))
18+
fmt.Println()
19+
20+
fmt.Printf("%13s %s\n", "light-black", aec.LightBlackB.Apply(" "))
21+
fmt.Printf("%13s %s\n", "light-red", aec.LightRedB.Apply(" "))
22+
fmt.Printf("%13s %s\n", "light-green", aec.LightGreenB.Apply(" "))
23+
fmt.Printf("%13s %s\n", "light-yellow", aec.LightYellowB.Apply(" "))
24+
fmt.Printf("%13s %s\n", "light-blue", aec.LightBlueB.Apply(" "))
25+
fmt.Printf("%13s %s\n", "light-magenta", aec.LightMagentaB.Apply(" "))
26+
fmt.Printf("%13s %s\n", "light-cyan", aec.LightCyanB.Apply(" "))
27+
fmt.Printf("%13s %s\n", "light-white", aec.LightWhiteB.Apply(" "))
28+
fmt.Println()
29+
30+
for r := uint8(0); r < 6; r++ {
31+
for g := uint8(0); g < 6; g++ {
32+
for b := uint8(0); b < 6; b++ {
33+
ansi := aec.Color8BitB(aec.NewRGB8Bit(r*43, g*43, b*43))
34+
fmt.Printf("%02x-%02x-%02x %s ", r*43, g*43, b*43, ansi.Apply(" "))
35+
}
36+
fmt.Println()
37+
}
38+
fmt.Println()
39+
}
40+
41+
fmt.Println(aec.Bold.Apply("bold"))
42+
fmt.Println(aec.Faint.Apply("faint"))
43+
fmt.Println(aec.Italic.Apply("italic"))
44+
fmt.Println(aec.Underline.Apply("underline"))
45+
fmt.Println(aec.BlinkSlow.Apply("blink-slow"))
46+
fmt.Println(aec.BlinkRapid.Apply("blink-rapid"))
47+
fmt.Println(aec.Inverse.Apply("inverse"))
48+
fmt.Println(aec.Conceal.Apply("conceal"))
49+
fmt.Println(aec.CrossOut.Apply("cross-out"))
50+
fmt.Println(aec.Frame.Apply("frame"))
51+
fmt.Println(aec.Encircle.Apply("encircle"))
52+
fmt.Println(aec.Overline.Apply("overline"))
53+
}

0 commit comments

Comments
 (0)