Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rajdee/simple-color-functions
Set of color functions
https://github.com/rajdee/simple-color-functions
Last synced: 2 months ago
JSON representation
Set of color functions
- Host: GitHub
- URL: https://github.com/rajdee/simple-color-functions
- Owner: rajdee
- License: mit
- Created: 2019-01-22T19:30:27.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-14T20:54:23.000Z (almost 5 years ago)
- Last Synced: 2024-03-15T10:00:49.394Z (10 months ago)
- Language: TypeScript
- Size: 289 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple color functions [![Build Status][ci-img]][ci]
[ci-img]: https://travis-ci.org/rajdee/simple-color-functions.svg
[ci]: https://travis-ci.org/rajdee/simple-color-functionsJavascript library with a set of functions of manipulation and color conversion.
## Installation
```sh
npm install simple-color-functions --save-dev
```
or
```sh
yarn add -D simple-color-functions
```## Usage
Several examples of color manipulation
```javascript
colors('#23bc98').brighten(1.2).hex(); // #71fad3
colors('#23bc98').darken(0.5).hex(); // #00a381
``````javascript
colors('#23bc98').css(); // rgb(35,188,152)
``````javascript
colors('#23bc98').alpha(.5).css(); // rgba(35,188,152.5)
``````javascript
colors('#23bc98').brightness('-20%').hex(); // #009675
colors('#23bc98').brightness(-0.2).hex(); // #009675
``````javascript
colors('#fff').contrast('#23bc98'); // 2.3348071108457673
colors('#23bc98').luminance(); // 0.39971595089054046
```