summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--std/fmt/README.md45
1 files changed, 45 insertions, 0 deletions
diff --git a/std/fmt/README.md b/std/fmt/README.md
index d71fdf4d0..8c44d78a7 100644
--- a/std/fmt/README.md
+++ b/std/fmt/README.md
@@ -7,6 +7,10 @@ If you are looking for the documentation proper, skip to:
"printf: prints formatted output"
+and
+
+ "Colors"
+
below.
## Discussion
@@ -190,6 +194,47 @@ Too few arguments:
S("%d") %!(MISSING 'd')"
+# Colors
+
+Adds functions used for displaying colored text.
+
+## Usage
+
+```typescript
+import {
+ bgBlue,
+ bgRgb24,
+ bgRgb8,
+ bold,
+ italic,
+ red,
+ rgb24,
+ rgb8,
+} from "https://deno.land/std@$STD_VERSION/fmt/colors.ts";
+
+console.log(bgBlue(italic(red(bold("Hello, World!")))));
+
+// also supports 8bit colors
+
+console.log(rgb8("Hello, World!", 42));
+
+console.log(bgRgb8("Hello, World!", 42));
+
+// and 24bit rgb
+
+console.log(rgb24("Hello, World!", {
+ r: 41,
+ g: 42,
+ b: 43,
+}));
+
+console.log(bgRgb24("Hello, World!", {
+ r: 41,
+ g: 42,
+ b: 43,
+}));
+```
+
[1]: https://pubs.opengroup.org/onlinepubs/009695399/functions/fprintf.html
[2]: https://golang.org/pkg/fmt/
[3]: https://console.spec.whatwg.org/#object-formats