Skip to content

Commit

Permalink
Chore/docs (#5)
Browse files Browse the repository at this point in the history
* chore: add keywords

* chore(readme): update ts support

* docs: update README with examples

* doc(ts): add doc
  • Loading branch information
kettei-sproutty authored Aug 17, 2024
1 parent 7d8eed6 commit 4dbef47
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 6 deletions.
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
# [WIP] Node Styles
# colsys

![npm bundle size](https://img.shields.io/bundlephobia/min/colsys)

WIP light and zero-dependecy terminal string styling library.

## Guide

```ts
import colsys from 'colsys';

// modifiers
colsys.bold("bold");

// colors
colsys.red("red");

// background
colsys.bgRed("bgRed");

// chaining
colsys.bold.bgBlack.white("Hello, world!");
```

## Roadmap

- [ ] Typescript support
- [x] Typescript support
- [ ] Chalk basic compatibility
- [x] Combine styled and normal strings
- [x] Compose multiple styles using the chainable API
Expand Down
31 changes: 28 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
{
"name": "node-styles",
"version": "0.1.0",
"description": "",
"description": "A light and zero-dependecy terminal string styling library",
"license": "(MIT OR Apache-2.0)",
"keywords": [],
"files": ["src", "package.json"],
"keywords": [
"colsys",
"color",
"colors",
"terminal",
"console",
"style",
"styles",
"format",
"log",
"text",
"terminal-colors",
"text-styling",
"terminal-styling",
"console-colors",
"terminal-effects",
"color-toolkit",
"console-effects"
],
"files": [
"src",
"package.json",
"README.md",
"LICENSE-APACHE",
"LICENSE-MIT"
],
"repository": "https://github.com/kettei-sproutty/colsys.git",
"exports": {
".": {
"default": "./src/main.mjs",
Expand Down
12 changes: 11 additions & 1 deletion src/main.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,18 @@ type NodeStylesProxy = {
[key in Params]: NodeStylesProxy & ((...args: any[]) => string);
};

/**
* Returns a formatted text based on `colors`, `bg` and `modifiers`, based on
* [node:util styleText](https://nodejs.org/docs/latest-v22.x/api/util.html#utilstyletextformat-text).
* @example
* ```ts
* colsys.bold("bold");
* colsys.red("red");
* colsys.bgRed("bgRed");
* colsys.red.bold("red+bold");
* ```
*/
declare const nodeStyles: NodeStylesProxy;

nodeStyles.bgBlack("hello");

export default nodeStyles;

0 comments on commit 4dbef47

Please sign in to comment.