UNPKG

redux-devtools-log-monitor-no-peers

Version:
20 lines (17 loc) 492 B
'use strict'; exports.__esModule = true; exports.default = function (hexColor, lightness) { var hex = String(hexColor).replace(/[^0-9a-f]/gi, ''); if (hex.length < 6) { hex = hex.replace(/(.)/g, '$1$1'); } var lum = lightness || 0; var rgb = '#'; var c = void 0; for (var i = 0; i < 3; ++i) { c = parseInt(hex.substr(i * 2, 2), 16); c = Math.round(Math.min(Math.max(0, c + c * lum), 255)).toString(16); rgb += ('00' + c).substr(c.length); } return rgb; };