You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[ANSI 256 colors](#256-colors) via methods: `fg(num)`, `bg(num)`
42
42
-[Truecolor](#truecolor) via methods: `rgb(r,g,b)`, `bgRgb(r,g,b)`, `hex('#rrggbb')`, `bgHex('#rrggbb')`
43
-
-[Named truecolor](#extend-colors) (extendable with colors such as [pink, indigo, navy, ...](https://drafts.csswg.org/css-color/#named-colors)): `ansis.pink()`, `ansis.bgPink()`, ...
43
+
-[Named truecolors](#extend-colors) (extend with colors such as [orange, pink, navy, ...](https://drafts.csswg.org/css-color/#named-colors)): `ansis.pink()`, `ansis.bgPink()`, ...
- Raw ANSI escape codes: ``` `File ${red.open}not found${red.close} in directory` ```
@@ -449,7 +449,7 @@ If a terminal supports only 16 colors then ANSI 256 colors will be interpolated
449
449
</a>
450
450
</div>
451
451
452
-
#### Usage example
452
+
#### Example
453
453
454
454
```js
455
455
import { bold, fg, bg } from'ansis';
@@ -512,28 +512,30 @@ If you use the `hex()`, `rgb()` or `ansis256()` functions in a terminal not supp
512
512
513
513

514
514
515
+
See also [fallback for named truecolors](#fallback-for-named-truecolors).
516
+
515
517
#### [↑ top](#top)
516
518
517
519
<aid="extend-colors"name="extend-colors"></a>
518
520
519
-
## Named truecolor
521
+
## Named truecolors
520
522
521
523
Ansis supports full 24-bit color via `ansis.rgb(r, g, b)` and `ansis.hex('#rrggbb')`.\
522
-
If you prefer [**named colors**](http://dev.w3.org/csswg/css-color/#named-colors) (e.g. `pink`, `orange`, `indigo`, etc.)
524
+
If you prefer [**named colors**](http://dev.w3.org/csswg/css-color/#named-colors) (e.g. `orange`, `pink`, `navy`, etc.)
523
525
instead of writing hex or RGB values by hand, resolve color names in your app and register them as extended styles on an Ansis instance via `ansis.extend()`.
524
526
Then you can call e.g., `color.pink()` or `color.bgPink()` rather than using `ansis.hex('#ffc0cb')` or `ansis.bgHex('#ffc0cb')` directly.
525
527
526
528
> [!IMPORTANT]
527
529
> Foreground methods are created from the provided color names, and matching background methods `bg*` are generated automatically.
528
530
529
531
> [!NOTE]
530
-
> To keep Ansis small, it doesn't bundle large truecolor name tables.\
532
+
> To keep Ansis small, it doesn't bundle large truecolors name table.\
531
533
> Use any mapping package you like, e.g. [css-color-names](https://www.npmjs.com/package/css-color-names) (~6 kB).
532
534
> ```bash
533
535
> npm i css-color-names
534
536
>```
535
537
536
-
**Example (extend with all color names)**
538
+
**Example (extend with all [CSS color names](http://dev.w3.org/csswg/css-color/#named-colors) )**
0 commit comments