diff options
author | Oliver Lenehan <sunsetkookaburra+git@outlook.com.au> | 2020-05-09 20:29:44 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-09 06:29:44 -0400 |
commit | 7d3728e3f4b8c9764518bcbe7e4a49cd18fb1f90 (patch) | |
tree | b1cd1f334e14ef188c0c96a4dcc699b7b09fc09a /std/fmt/colors_test.ts | |
parent | 9790399bcea36091da85799c4ed86ead6c9af92a (diff) |
feat(std/fmt): 8bit and 24bit ANSI colors (#5168)
Diffstat (limited to 'std/fmt/colors_test.ts')
-rw-r--r-- | std/fmt/colors_test.ts | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/std/fmt/colors_test.ts b/std/fmt/colors_test.ts index 6c80b4109..cfa189d30 100644 --- a/std/fmt/colors_test.ts +++ b/std/fmt/colors_test.ts @@ -118,3 +118,41 @@ Deno.test("testBgCyan", function (): void { Deno.test("testBgWhite", function (): void { assertEquals(c.bgWhite("foo bar"), "[47mfoo bar[49m"); }); + +Deno.test("testClampUsingRgb8", function (): void { + assertEquals(c.rgb8("foo bar", -10), "[38;5;0mfoo bar[39m"); +}); + +Deno.test("testTruncateUsingRgb8", function (): void { + assertEquals(c.rgb8("foo bar", 42.5), "[38;5;42mfoo bar[39m"); +}); + +Deno.test("testRgb8", function (): void { + assertEquals(c.rgb8("foo bar", 42), "[38;5;42mfoo bar[39m"); +}); + +Deno.test("test_bgRgb8", function (): void { + assertEquals(c.bgRgb8("foo bar", 42), "[48;5;42mfoo bar[49m"); +}); + +Deno.test("test_rgb24", function (): void { + assertEquals( + c.rgb24("foo bar", { + r: 41, + g: 42, + b: 43, + }), + "[38;2;41;42;43mfoo bar[39m" + ); +}); + +Deno.test("test_bgRgb24", function (): void { + assertEquals( + c.bgRgb24("foo bar", { + r: 41, + g: 42, + b: 43, + }), + "[48;2;41;42;43mfoo bar[49m" + ); +}); |