Author:ptrace
Comitter:ptrace
Date:2025-12-09 17:06:37 UTC
diff --git a/termcolors/lib.jai b/termcolors/lib.jai
index 92a61c4..02f921b 100644
--- a/termcolors/lib.jai
+++ b/termcolors/lib.jai
@@ -24,7 +24,7 @@
*/
/*
+Version: 1.0.0
+Version: 1.0.1
-------------------
--- [ paint() ] ---
@@ -47,6 +47,9 @@
Applies a font weight, foreground and background colors
log(paint("Foo Bar", .BOLD, .BLACK, .WHITE));
Applies only foreground and background colors
log(paint("Foo Bar", .RESET, .BLACK, .WHITE));
Applies multiple text decorations
log(paint("Foo Bar", .[.BOLD, .UNDERLINE, .ITALIC], .BLACK, .WHITE));
@@ -143,7 +146,7 @@
paint :: (
str: string,
style: Text_Style = .NONE,
style: Text_Style = .RESET,
fg: Color_Foreground = .NONE,
bg: Color_Background = .NONE
) -> string
@@ -163,7 +166,7 @@ paint :: (
paint_ex :: (
str: string,
style: Text_Style = .NONE,
style: Text_Style = .RESET,
fg_color: Color_Table = .NONE,
bg_color: Color_Table = .NONE
) -> string
@@ -176,7 +179,7 @@ paint_ex :: (
paint_ex :: (
str: string,
style: Text_Style = .NONE,
style: Text_Style = .RESET,
fg_color: int = -1,
bg_color: int = -1
) -> string
@@ -216,7 +219,7 @@ paint_ex :: (
paint_ex_custom :: (
str: string,
style: Text_Style = .NONE,
style: Text_Style = .RESET,
fg_color: $A,
bg_color: $B
) -> string
@@ -230,7 +233,7 @@ paint_ex_custom :: (
paint_rgb :: (
str: string,
style: Text_Style = .NONE,
style: Text_Style = .RESET,
fg_rgb: Term_Rgb,
bg_rgb: Term_Rgb
) -> string
@@ -259,8 +262,6 @@ Term_Rgb :: struct {
Text_Style :: enum #specified {
NONE :: -1;
RESET :: 0;
BOLD :: 1;
FAINT :: 2; // not widely supported
diff --git a/test/test.jai b/test/test.jai
index 10f36af..e2c61de 100644
--- a/test/test.jai
+++ b/test/test.jai
@@ -4,7 +4,7 @@
#import "termcolors";
MEMORY_DEBUGGER :: true;
MEMORY_DEBUGGER :: false;
main :: () {
@@ -19,26 +19,29 @@ main :: () {
log(paint("2 Bold, fg Black", .BOLD, .BLACK));
print("\n");
log(paint("3 Bold, fg Black, bg White", .BOLD, .BLACK, .WHITE));
log(paint("3 fg Black", .RESET, .BLACK));
print("\n");
log(paint("4 Bold, Underline, Italic, fg Black, bg White", .[.BOLD, .UNDERLINE, .ITALIC], .BLACK, .WHITE));
log(paint("4 Bold, fg Black, bg White", .BOLD, .BLACK, .WHITE));
print("\n");
log(paint("5 Bold, Underline, Italic, fg Black, bg White", .[.BOLD, .UNDERLINE, .ITALIC], .BLACK, .WHITE));
print("\n\n");
log("--- paint_ex() -----------------------------");
log(paint_ex("5 Underline, fg GreenDark, bg OrangeLight", .UNDERLINE, .GREEN_DARK, .ORANGE_LIGHT));
log(paint_ex("6 Underline, fg GreenDark, bg OrangeLight", .UNDERLINE, .GREEN_DARK, .ORANGE_LIGHT));
print("\n");
log(paint_ex("6 Underline, fg GreenDark", .UNDERLINE, .GREEN_DARK));
log(paint_ex("7 Underline, fg GreenDark", .UNDERLINE, .GREEN_DARK));
print("\n");
log(paint_ex("7 Bold, Underline, Italic, fg GreenDark, bg OrangeLight", .[.BOLD, .UNDERLINE, .ITALIC], .GREEN_DARK, .ORANGE_LIGHT));
log(paint_ex("8 Bold, Underline, Italic, fg GreenDark, bg OrangeLight", .[.BOLD, .UNDERLINE, .ITALIC], .GREEN_DARK, .ORANGE_LIGHT));
print("\n");
log(paint_ex("8 Underline, fg 84, bg 124", .UNDERLINE, 84, 124));
log(paint_ex("9 Underline, fg 84, bg 124", .UNDERLINE, 84, 124));
print("\n");
log(paint_ex("9 Bold, Underline, Italic, 84, 124", .[.BOLD, .UNDERLINE, .ITALIC], 84, 124));
log(paint_ex("10 Bold, Underline, Italic, 84, 124", .[.BOLD, .UNDERLINE, .ITALIC], 84, 124));
print("\n\n");
log("--- paint_ex_custom() -----------------------------");
@@ -48,18 +51,18 @@ main :: () {
COL2 :: 201;
}
log(paint_ex_custom("10 Underline, fg Custom, bg Custom", .UNDERLINE, My_Colors.COL1, My_Colors.COL2));
log(paint_ex_custom("11 Underline, fg Custom, bg Custom", .UNDERLINE, My_Colors.COL1, My_Colors.COL2));
print("\n\n");
log("--- paint_rgb() -----------------------------");
log(paint_rgb("11 Underline, fg rgb(255,0,0), bg rgb(0,0,255)", .UNDERLINE, .{ 255, 0, 0 }, .{ 0, 0, 255 }));
log(paint_rgb("12 Underline, fg rgb(255,0,0), bg rgb(0,0,255)", .UNDERLINE, .{ 255, 0, 0 }, .{ 0, 0, 255 }));
print("\n");
log(paint_rgb("12 Bold, Underline, Italic, fg rgb(255,0,0), bg rgb(0,0,255)", .[.BOLD, .UNDERLINE, .ITALIC], .{ 255, 0, 0 }, .{ 0, 0, 255 }));
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 }));
print("\n\n");
log("--- paint_raw_temp() -----------------------------");
log(paint_raw("1;3;32;45", "13 tbd tbd tbd"));
log(paint_raw("1;3;32;45", "14 tbd tbd tbd"));
print("\n\n");
}