An open API service indexing awesome lists of open source software.

https://github.com/arjunkdot/hexashades

🎨 A simple JavaScript package for creating tints and shades for a given RGB hex code.
https://github.com/arjunkdot/hexashades

colors hex hexashades javascirpt js-library rgb shades tints tints-and-shades typescript

Last synced: 7 months ago
JSON representation

🎨 A simple JavaScript package for creating tints and shades for a given RGB hex code.

Awesome Lists containing this project

README

          

![Creating tints and shades for a given RGB hex code.](.github/banner.jpg "Creating tints and shades for a given RGB hex code.")

Hexashades



NPM Version
NPM Bundle Size
License





Hexashades helps you generate a range of shades and tints for any specified RGB Hex color code.



> Currently, it only supports RGB Hex codes. More input formats will be allowed in the future.

## Installation

**NPM**

```sh
npm install hexashades --save
```

Or load using a `` tag from a CDN

```html
<script src="https://cdn.jsdelivr.net/npm/hexashades/">
```

## Usage

```js
// Import Hexashades & initialize.
import { Colors } from "hexashades";
const color = new Colors();

// Generate tints & shades.
const tintsAndShades = color.createColors("663399", 10, false);
```

## API

### createColors(color, percentage, prefix)

Returns an array of tints & shades for the given color with a given percentage of increments.

Throws an error if no/invalid inputs are given.

- `@param {string} color` - a valid RGB hex code without #
- `@param {number} percentage` - a valid percentage value between 0 and 100
- `@param {boolean} prefix` - (Optional) true/false. Whether the output should include #
- `@return {Array}` - array with hex codes

## License

MIT © arjunkdot