UNPKG

netlify-cms-core

Version:

Netlify CMS core application, see netlify-cms package for the main distribution.

18 lines (14 loc) 382 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.stringToRGB = stringToRGB; function stringToRGB(str) { if (!str) return '000000'; let hash = 0; for (let i = 0; i < str.length; i++) { hash = str.charCodeAt(i) + ((hash << 5) - hash); } const c = (hash & 0x00ffffff).toString(16).toUpperCase(); return `00000${c}`.slice(-6); }