Color Scheme

node v0.12.18
version: 3.0.0
endpointsharetweet
var http = require('request-promise'); var _ = require('lodash'); var URL = "http://www.colr.org/json/scheme/random"; async function randomColorScheme() { var response = await http(URL); var scheme = JSON.parse(response)['schemes'][0]; try { var colors = _.map(scheme['colors'], function(c) {return "#" + c}); var tags = _.map(scheme['tags'], function(t) {return t['name']}); return {colors: colors, tags: tags}; } catch (e) { return {}; } }; module.exports = randomColorScheme;
Loading…

no comments

    sign in to comment