Name to Color

node v8.17.0
version: 4.0.0
endpointsharetweet
const tinycolor = require("tinycolor2") const stringHash = require("string-hash"); const faker = require('faker'); const _ = require('lodash'); const baseColor = tinycolor('#25bcca'); const hsl = baseColor.toHsl(); console.log('S', hsl.s, 'L', hsl.l); _.times(30, () => { const name = faker.name.findName(); const hash = stringHash(name); // const color = tinycolor({ h: hash % 255, s: 60, l: 40 + (hash % 20) }); const color = tinycolor({ h: hash % 255, s: hsl.s, l: hsl.l }); const initial = name[0].toUpperCase(); return({initial, color: color.toHexString(), name}); });
baseColor.analogous(40).map(c => c.toHexString());
Loading…

no comments

    sign in to comment