Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arjunkdot/hexashades
A simple JavaScript library for creating tints and shades for a given RGB hex code.
https://github.com/arjunkdot/hexashades
colors css hex hexashades javascirpt js-library npm rgb shades tints tints-and-shades typescript
Last synced: 4 days ago
JSON representation
A simple JavaScript library for creating tints and shades for a given RGB hex code.
- Host: GitHub
- URL: https://github.com/arjunkdot/hexashades
- Owner: arjunkdot
- License: mit
- Created: 2023-10-02T12:02:01.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-22T18:34:19.000Z (10 months ago)
- Last Synced: 2024-09-05T09:40:04.598Z (2 months ago)
- Topics: colors, css, hex, hexashades, javascirpt, js-library, npm, rgb, shades, tints, tints-and-shades, typescript
- Language: TypeScript
- Homepage: https://github.com/arjunkdot/hexashades
- Size: 241 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Hexashades
![NPM Version](https://img.shields.io/npm/v/hexashades?logo=npm&color=%23CB0001)
![NPM Bundle Size](https://img.shields.io/bundlephobia/min/hexashades)
![License](https://img.shields.io/github/license/arjunkdot/hexashades)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