@thi.ng/text-format
Advanced tools
Comparing version 2.1.4 to 2.1.5
# Change Log | ||
- **Last updated**: 2024-03-01T15:22:50Z | ||
- **Last updated**: 2024-03-02T14:05:53Z | ||
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub) | ||
@@ -5,0 +5,0 @@ |
{ | ||
"name": "@thi.ng/text-format", | ||
"version": "2.1.4", | ||
"version": "2.1.5", | ||
"description": "Customizable color text formatting with presets for ANSI & HTML", | ||
@@ -40,3 +40,3 @@ "type": "module", | ||
"@thi.ng/hex": "^2.3.38", | ||
"@thi.ng/memoize": "^3.1.61" | ||
"@thi.ng/memoize": "^3.1.62" | ||
}, | ||
@@ -107,3 +107,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "d660ae8fd1bf64d919b4334f19509f1f539d70f6\n" | ||
"gitHead": "df9e312af741d87e6b450afcfea6a6e381662b1e\n" | ||
} |
@@ -154,10 +154,20 @@ <!-- This file is generated - DO NOT EDIT! --> | ||
```ts | ||
import { defFormat, FMT_HTML_INLINE_CSS, FG_LIGHT_RED, BG_GRAY } from "@thi.ng/text-format"; | ||
// create & use a HTML formatter | ||
defFormat(FMT_HTML_INLINE_CSS, FG_LIGHT_RED | BG_GRAY)("hello") | ||
// "<span style="color:#f55;background:#555;">hello</span>" | ||
``` | ||
```ts | ||
import { defFormat, FMT_ANSI16, FG_LIGHT_RED, BG_GRAY } from "@thi.ng/text-format"; | ||
// create & use an ANSI formatter | ||
defFormat(FMT_ANSI16, FG_LIGHT_RED | BG_GRAY)("hello") | ||
// "\x1B[91;100mhello\x1B[0m" | ||
``` | ||
```ts | ||
import { defAnsi16, FG_LIGHT_RED, BG_GRAY } from "@thi.ng/text-format"; | ||
// ANSI syntax sugar (same result as above) | ||
@@ -174,2 +184,4 @@ defAnsi16(FG_LIGHT_RED | BG_GRAY)("hello") | ||
```ts | ||
import { defFormatPresets, FMT_ANSI16, FMT_HTML_TACHYONS } from "@thi.ng/text-format"; | ||
// since v1.3.0 also available as PRESET_ANSI16 | ||
@@ -176,0 +188,0 @@ const ansi = defFormatPresets(FMT_ANSI16); |
46417
271
Updated@thi.ng/memoize@^3.1.62