https://github.com/corygibbons/iromi
🎨 WIP — Collection of JS colour functions that automate the selection of beautiful, accessible colours.
https://github.com/corygibbons/iromi
a11y accessible-colours color colour colours js wcag
Last synced: 6 months ago
JSON representation
🎨 WIP — Collection of JS colour functions that automate the selection of beautiful, accessible colours.
- Host: GitHub
- URL: https://github.com/corygibbons/iromi
- Owner: corygibbons
- License: mit
- Created: 2016-12-14T06:23:17.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-06T07:37:12.000Z (over 7 years ago)
- Last Synced: 2025-03-24T15:16:20.697Z (6 months ago)
- Topics: a11y, accessible-colours, color, colour, colours, js, wcag
- Language: JavaScript
- Homepage:
- Size: 157 KB
- Stars: 8
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Iromi
Iromi is a collection of JS colour functions that automate the selection of beautiful, accessible colours.
[](https://www.npmjs.com/package/iromi)
[](https://github.com/prettier/prettier)## Install
```
$ npm install iromi --save
```## Functions
#### `iromi.type(backgroundColor, contrast, size)`
* **`backgroundColor`**:
* Valid colour string (`#ffffff`, `rgb(0,0,0)`)
* **`contrast`**:
* `'default'`: AA compliant
* `'more'`: AAA compliant
* `'less`: Not compliant
* **`size`**:
* `'small'`
* `'large'````js
const iromi = require('iromi');// Will return a text colour that is AA compliant on #ffffff
textOnWhiteBg = iromi.type('#ffffff');// Will return a text colour is AA compliant on #000000
textOnBlackBg = iromi.type('#000000');// Iromi will try to return an AA compliant text colour if no contrast argument
// is given. The following will try to return an AAA compliant text colour.
textOnWhiteBgAAA = iromi.type('#ffffff', 'more');// Since Iromi returns a tinycolor object it's easy to choose your format
textOnWhiteBg.toHexString(); // '#727272'
textOnWhiteBg.toRgbString(); // 'rgb(115, 115, 115)'
```