From 1142b7e6606d776ab8cf59a28ae4bce18d768ee2 Mon Sep 17 00:00:00 2001 From: Steffen Waldmann Date: Thu, 26 Sep 2024 15:11:55 +0200 Subject: [PATCH 1/4] Document `cds.utils.colors` --- .vitepress/theme/custom.scss | 3 +++ node.js/cds-utils.md | 14 ++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/.vitepress/theme/custom.scss b/.vitepress/theme/custom.scss index 31da52de5..c8e921e64 100644 --- a/.vitepress/theme/custom.scss +++ b/.vitepress/theme/custom.scss @@ -250,6 +250,7 @@ main { .constructor::before { content: 'Constructor: '; color: #999 } .annotation::before { content: 'Annotation: '; color: #999 } .property::before { content: 'Property: '; color: #999 } + .module::before { content: 'Module: '; color: #999 } .method::before { content: 'Method: '; color: #999 } .event::before { content: 'Event: '; color: #999 } .class::before { content: 'Class: '; color: #999 } @@ -262,10 +263,12 @@ main { } h4.annotation + h4.annotation, h4.property + h4.property, + h4.module + h4.module, h4.event + h4.event, h4.method + h4.method, h3.annotation + h3.annotation, h3.property + h3.property, + h3.module + h3.module, h3.event + h3.event, h3.class + h3.class, h3.method + h3.method { diff --git a/node.js/cds-utils.md b/node.js/cds-utils.md index 0dec4e83b..5b3449369 100644 --- a/node.js/cds-utils.md +++ b/node.js/cds-utils.md @@ -245,7 +245,21 @@ await rm('dist/db/data') The implementation essentially uses `fs.promises.rm()`, with relative fileames resolved in relation to [`cds.root`](cds-facade#cds-root). +### colors {.module} +Provides utilities for coloring terminal output. Colors are automatically enabled if the terminal supports it, but can be oversteered via environment variables `NO_COLOR` or `FORCE_COLOR`. + +```js +const { BRIGHT, RED, RESET, bg } = cds.utils.colors +console.log(BRIGHT, RED, 'this is bright red text', RESET) +console.log(bg.BLUE, 'this is text with a blue background', RESET) +``` + +| **Category** | **Values** | +|----------------------|-------------------------------------------------------------------------------------------| +| **Formatting** | `RESET`, `BOLD`, `BRIGHT`, `DIMMED`, `ITALIC`, `UNDER`, `BLINK`, `FLASH`, `INVERT` | +| **Text Colors** | `BLACK`, `RED`, `GREEN`, `YELLOW`, `BLUE`, `PINK`, `CYAN`, `LIGHT_GRAY`, `DEFAULT`, `GRAY`, `LIGHT_RED`, `LIGHT_GREEN`, `LIGHT_YELLOW`, `LIGHT_BLUE`, `LIGHT_PINK`, `LIGHT_CYAN`, `WHITE` | +| **Background Colors** | `BLACK`, `RED`, `GREEN`, `YELLOW`, `BLUE`, `PINK`, `CYAN`, `WHITE`, `DEFAULT`, `LIGHT_GRAY`, `LIGHT_RED`, `LIGHT_GREEN`, `LIGHT_YELLOW`, `LIGHT_BLUE`, `LIGHT_PINK`, `LIGHT_CYAN`, `LIGHT_WHITE` | ## Shortcuts to Node.js Modules From d86774cba45f42df673d7440ec0a85a65522a118 Mon Sep 17 00:00:00 2001 From: Steffen Waldmann Date: Thu, 26 Sep 2024 15:16:24 +0200 Subject: [PATCH 2/4] rm .module --- .vitepress/theme/custom.scss | 2 -- node.js/cds-utils.md | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.vitepress/theme/custom.scss b/.vitepress/theme/custom.scss index c8e921e64..de758be5c 100644 --- a/.vitepress/theme/custom.scss +++ b/.vitepress/theme/custom.scss @@ -250,7 +250,6 @@ main { .constructor::before { content: 'Constructor: '; color: #999 } .annotation::before { content: 'Annotation: '; color: #999 } .property::before { content: 'Property: '; color: #999 } - .module::before { content: 'Module: '; color: #999 } .method::before { content: 'Method: '; color: #999 } .event::before { content: 'Event: '; color: #999 } .class::before { content: 'Class: '; color: #999 } @@ -268,7 +267,6 @@ main { h4.method + h4.method, h3.annotation + h3.annotation, h3.property + h3.property, - h3.module + h3.module, h3.event + h3.event, h3.class + h3.class, h3.method + h3.method { diff --git a/node.js/cds-utils.md b/node.js/cds-utils.md index 5b3449369..7fd8c4851 100644 --- a/node.js/cds-utils.md +++ b/node.js/cds-utils.md @@ -245,7 +245,7 @@ await rm('dist/db/data') The implementation essentially uses `fs.promises.rm()`, with relative fileames resolved in relation to [`cds.root`](cds-facade#cds-root). -### colors {.module} +### colors {.property} Provides utilities for coloring terminal output. Colors are automatically enabled if the terminal supports it, but can be oversteered via environment variables `NO_COLOR` or `FORCE_COLOR`. From a4a793d9e243085f5c9d9a3645dac38386c53dc3 Mon Sep 17 00:00:00 2001 From: Steffen Waldmann Date: Thu, 26 Sep 2024 15:17:20 +0200 Subject: [PATCH 3/4] Update cds-utils.md --- node.js/cds-utils.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node.js/cds-utils.md b/node.js/cds-utils.md index 7fd8c4851..bd8aaed8d 100644 --- a/node.js/cds-utils.md +++ b/node.js/cds-utils.md @@ -247,7 +247,7 @@ The implementation essentially uses `fs.promises.rm()`, with relative fileames r ### colors {.property} -Provides utilities for coloring terminal output. Colors are automatically enabled if the terminal supports it, but can be oversteered via environment variables `NO_COLOR` or `FORCE_COLOR`. +Provides utilities for coloring terminal output. Colors are automatically enabled if the terminal supports it, but can be overridden via environment variables `NO_COLOR` or `FORCE_COLOR`. ```js const { BRIGHT, RED, RESET, bg } = cds.utils.colors From 897ef900302bf9a3760977aea189a1c6ea6e3f76 Mon Sep 17 00:00:00 2001 From: Steffen Waldmann Date: Thu, 26 Sep 2024 15:18:36 +0200 Subject: [PATCH 4/4] more rm --- .vitepress/theme/custom.scss | 1 - 1 file changed, 1 deletion(-) diff --git a/.vitepress/theme/custom.scss b/.vitepress/theme/custom.scss index de758be5c..31da52de5 100644 --- a/.vitepress/theme/custom.scss +++ b/.vitepress/theme/custom.scss @@ -262,7 +262,6 @@ main { } h4.annotation + h4.annotation, h4.property + h4.property, - h4.module + h4.module, h4.event + h4.event, h4.method + h4.method, h3.annotation + h3.annotation,