Skip to content

Commit

Permalink
docs: Update README.md API Reference (#12)
Browse files Browse the repository at this point in the history
- Fix toRgb(), toHsl(), toHsv(), and toCmyk() methods description
- Add toNamed() method description
  • Loading branch information
supitsdu authored Jun 10, 2024
1 parent 0ff90bc commit d0ae68f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ npm i colorus-js
## Usage

```js
const { Colorus } = require('colorus-js');
const { Colorus } = require('colorus-js')

// Create a new Colorus instance
const color = new Colorus('rgb(255 0 0)');
const color = new Colorus('rgb(255 0 0)')

console.log(color.colorType); // Returns: 'rgb'
console.log(color.lighten(0.2).toHex({ minify: true })); // Returns: '#F33'
console.log(color.colorType) // Returns: 'rgb'
console.log(color.lighten(0.2).toHex({ minify: true })) // Returns: '#F33'
```

## API Reference
Expand Down Expand Up @@ -59,10 +59,11 @@ constructor(input?: AnyColor)
#### Methods

- `toHex(options): string`: Convert the current color to hexadecimal format.
- `toRgb(options): string`: Convert the current color to RgbObject format.
- `toHsl(options): string`: Convert the current color to HslObject format.
- `toHsv(options): string`: Convert the current color to HsvObject format.
- `toCmyk(options): string`: Convert the current color to CmykObject format.
- `toRgb(options): string`: Convert the current color to `RGB` string format.
- `toHsl(options): string`: Convert the current color to `HSL` string format.
- `toHsv(options): string`: Convert the current color to `HSV` string format.
- `toCmyk(options): string`: Convert the current color to `CMYK` string format.
- `toNamed(): string`: Convert the current color to its nearest [CSS named color](https://www.w3.org/TR/css-color-4/#named-colors) representation.
- `mix(input, amount): Colorus`: Mixes the current color with another color.
- `lighten(amount): Colorus`: Lightens the current color.
- `darken(amount): Colorus`: Darkens the current color.
Expand Down

0 comments on commit d0ae68f

Please sign in to comment.