Logo

index : termcolors-jai

---

  • summary
  • about
  • tree
  • log
  • branches
<< path: root/public/termcolors-jai.git/html/test/test.jai blob: aeb138b110b91d8c1b50fca7f54e1ad8bfc2997f [raw] [clear marker]

        
0#import "Basic"()(
1 MEMORY_DEBUGGER = MEMORY_DEBUGGER
2);
3#import "termcolors";
4
5
6MEMORY_DEBUGGER :: false;
7
8
9main :: () {
10 #if MEMORY_DEBUGGER defer report_memory_leaks();
11
12 termcolors_init_allocator_and_context();
13
14 // Technically you don't need do reset the pool for this example.
15 // But I keep it here, so you're aware of this procedure.
16 defer termcolors_reset_pool(overwrite_memory = true);
17
18 log("--- paint() -----------------------------");
19 log(paint("1 Plain"));
20 print("\n");
21
22 log(paint("2 Bold, fg Black", .BOLD, .BLACK));
23 print("\n");
24
25 log(paint("3 fg Black", .RESET, .BLACK));
26 print("\n");
27
28 log(paint("4 Bold, fg Black, bg White", .BOLD, .BLACK, .WHITE));
29 print("\n");
30
31 log(paint("5 Bold, Underline, Italic, fg Black, bg White", .[.BOLD, .UNDERLINE, .ITALIC], .BLACK, .WHITE));
32 print("\n\n");
33
34 log("--- paint_ex() -----------------------------");
35 log(paint_ex("6 Underline, fg GreenDark, bg OrangeLight", .UNDERLINE, .GREEN_DARK, .ORANGE_LIGHT));
36 print("\n");
37
38 log(paint_ex("7 Underline, fg GreenDark", .UNDERLINE, .GREEN_DARK));
39 print("\n");
40
41 log(paint_ex("8 Bold, Underline, Italic, fg GreenDark, bg OrangeLight", .[.BOLD, .UNDERLINE, .ITALIC], .GREEN_DARK, .ORANGE_LIGHT));
42 print("\n");
43
44 log(paint_ex("9 Underline, fg 84, bg 124", .UNDERLINE, 84, 124));
45 print("\n");
46
47 log(paint_ex("10 Bold, Underline, Italic, 84, 124", .[.BOLD, .UNDERLINE, .ITALIC], 84, 124));
48 print("\n\n");
49
50 log("--- paint_ex_custom() -----------------------------");
51 My_Colors :: enum #specified {
52 NONE :: -1;
53 COL1 :: 95;
54 COL2 :: 201;
55 }
56
57 log(paint_ex_custom("11 Underline, fg Custom, bg Custom", .UNDERLINE, My_Colors.COL1, My_Colors.COL2));
58 print("\n\n");
59
60 log("--- paint_rgb() -----------------------------");
61 log(paint_rgb("12 Underline, fg rgb(255,0,0), bg rgb(0,0,255)", .UNDERLINE, .{ 255, 0, 0 }, .{ 0, 0, 255 }));
62 print("\n");
63
64 log(paint_rgb("13 Bold, Underline, Italic, fg rgb(255,0,0), bg rgb(0,0,255)", .[.BOLD, .UNDERLINE, .ITALIC], .{ 255, 0, 0 }, .{ 0, 0, 255 }));
65 print("\n\n");
66
67 log("--- paint_raw() -----------------------------");
68 log(paint_raw("1;3;32;45", "14 tbd tbd tbd", no_termination = false));
69 print("\n\n");
70}
71
72
Copyright 2026  E766CB298A6D1E64 | Git-Thing heavily inspired by cgit