]>
git.r.bdr.sh - rbdr/forum/blob - src/utils/glyph_hash.js
120c02ace705490c7ceeea0a723554ae48aa2504
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
);