Skip to content

Commit

Permalink
feat: Returns hex colors now
Browse files Browse the repository at this point in the history
Returns hex colors instead of rgba object

BREAKING CHANGE: Does not return rgba objects anymore
  • Loading branch information
Jense5 committed Mar 7, 2017
1 parent a309686 commit d92f3a6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 28 deletions.
27 changes: 9 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@

<h1 align="center">Site Scheme</h1>
# Site Scheme

<p align="center"><b>Fetch color schemes from websites</b></p>
**Fetch color schemes from websites.**

<p align="center">
<img src="https://img.shields.io/travis/Jense5/site-scheme.svg?style=flat-square"/>
<img src="https://img.shields.io/npm/v/site-scheme.svg?style=flat-square"/>
<img src="https://img.shields.io/npm/l/site-scheme.svg?style=flat-square"/>
<img src="https://img.shields.io/codecov/c/github/Jense5/site-scheme.svg?style=flat-square"/>
<img src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square"/>
</p>
<img src="https://img.shields.io/travis/Jense5/site-scheme.svg?style=flat-square"/>
<img src="https://img.shields.io/npm/v/site-scheme.svg?style=flat-square"/>
<img src="https://img.shields.io/npm/l/site-scheme.svg?style=flat-square"/>
<img src="https://img.shields.io/codecov/c/github/Jense5/site-scheme.svg?style=flat-square"/>
<img src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square"/>

```sh
# Extract color schemes via terminal (optional output file).
# See the images and result below. The top is the color at the top of the site.
$ npm install -g site-scheme
$ site-scheme --url 'http://toledo.kuleuven.be' --number 5 --output 'output.png'
# Prints: {top:{"r":244,"g":245,"b":245,"a":255},colors:[{"r":29,"g":139,"b":177,"a":255},...]
# Prints: {"top":"#1E8EB1","colors":["#F3F5F5","#96C4D5",...]}
```

```js
Expand All @@ -26,11 +24,4 @@ extractScheme('http://toledo.kuleuven.be', 5, 'output.png').then((colors) => {
winston.info(JSON.stringify(colors, null, 4));
});
```

<p align="center" style="font-family:monospace"><b>- MIT -</b></p>

<h3 align="center">Input</h3>
<img src="http://i.imgur.com/ozx7yjg.png">

<h3 align="center">Output</h3>
<img src="http://i.imgur.com/fgQ3xP8.png">
<br /><img src="http://i.imgur.com/XAXi1CF.png">
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"dependencies": {
"bluebird": "^3.4.7",
"chalk": "^1.1.3",
"color-blocks": "^0.2.0",
"color-extract": "^0.3.2",
"color-blocks": "^1.0.0",
"color-extract": "^1.0.0",
"commander": "^2.9.0",
"commitizen": "^2.9.6",
"cz-conventional-changelog": "^2.0.0",
Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import isUrl from 'is-url';
import Promise from 'bluebird';
import capture from 'web-capture';
import { getProminentColors } from 'color-extract';
import { createColorPattern } from 'color-blocks';
import createPattern from 'color-blocks';

const CACHEA = path.resolve(__dirname, '5fba6621adbd97fec1d933874bf49e5a.png');
const CACHEB = path.resolve(__dirname, '5fba6621adbd97fec1d933874bf49e5b.png');
Expand Down Expand Up @@ -47,7 +47,7 @@ export default (url: string, amount: number, output: ?string) =>
if (output) {
const aop = path.resolve(process.cwd(), output);
const outputPath = path.extname(aop) === '.png' ? aop : path.resolve(aop, 'output.png');
createColorPattern(50, [colors.top, ...colors.colors], outputPath).then(() => {
createPattern(50, [colors.top, ...colors.colors], outputPath).then(() => {
resolve(colors);
}).catch(reject);
} else { resolve(colors); }
Expand Down
13 changes: 7 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -975,13 +975,14 @@ codecov@^1.0.1:
request ">=2.42.0"
urlgrey ">=0.4.0"

color-blocks@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/color-blocks/-/color-blocks-0.2.0.tgz#75a7696e25c6315e638874c431cd02233f0205a6"
color-blocks@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/color-blocks/-/color-blocks-1.0.0.tgz#9b6ea57445237d44fb79ea9e8f328d126261c092"
dependencies:
commitizen "^2.9.6"
cz-conventional-changelog "^2.0.0"
jimp "^0.2.27"
onecolor "^3.0.4"

color-difference@^0.3.4:
version "0.3.4"
Expand All @@ -990,9 +991,9 @@ color-difference@^0.3.4:
cli "^0.4.5"
color-model "^0.2.0"

color-extract@^0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/color-extract/-/color-extract-0.3.2.tgz#af3b729d45b6cc26e1ee7db8bd54d20a90678b11"
color-extract@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/color-extract/-/color-extract-1.0.0.tgz#19d5dcc66c1d35c592762721b80e5c328b265803"
dependencies:
chalk "^1.1.3"
clusterfck "^0.6.0"
Expand Down

0 comments on commit d92f3a6

Please sign in to comment.