Skip to content

Commit

Permalink
initialize repository
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsNickBarry committed Apr 29, 2019
0 parents commit 3adc4e1
Show file tree
Hide file tree
Showing 5 changed files with 510 additions and 0 deletions.
19 changes: 19 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2019 Zymulator

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Beer Color

Convert SRM or EBC to hex color.

Color values are provided by Barley Dog Brewery [here](https://www.barleydogbrewery.com/xml/colors.xml)

## Usage

Install the library:

```
npm install --save beer-color
```

Require the module and call one of the conversion functions:

```javascript
let beerColor = require('beer-color');

beerColor.fromSRM(4);
// => '#ECE61A'

beerColor.fromEBC(4);
// => '#F8F753'
```

The domain of valid inputs is 0 through 40 SRM. Input values are rounded to the nearest 0.1 SRM within this domain:

```javascript
beerColor.fromSRM(-1) === beerColor.fromSRM(0);
// => true

beerColor.fromSRM(Number.MAX_VALUE) === beerColor.fromSRM(40);
// => true

beerColor.fromSRM(Math.PI) === beerColor.fromSRM(3.1);
// => true
```
Loading

0 comments on commit 3adc4e1

Please sign in to comment.