]>
git.r.bdr.sh - rbdr/forum/blob - app/utils/glyph_hash.js
2d9b3f33df276a740e791a9f7fc18dc68b670ad5
2 kSplitterRegex: /.{1,8}/g,
23 // Return a glyph with color based on a 4 byte fragment of a UUIDv4
24 const getGlyphHashFragment = function (uuidFragment
) {
26 const glyphIndex
= parseInt(uuidFragment
.substring(0,2), 16) % 16;
28 glyph: internals
.kGlyphs
[glyphIndex
],
29 color: `#${uuidFragment.substring(2,8)}`
33 // Return an array of glyphs based on a UUIDv4
34 export const getGlyphHash = function (uuid
) {
36 const hashFragments
= uuid
.match(internals
.kSplitterRegex
);
37 return hashFragments
.map(getGlyphHashFragment
);