fix: emoji 的分割

This commit is contained in:
Clansty 2024-01-30 15:50:57 +08:00
parent f3a0a583de
commit 17669d5a60
No known key found for this signature in database
GPG Key ID: 3A6BE8BAF2EDE134
1 changed files with 1 additions and 1 deletions

View File

@ -3,7 +3,7 @@ import random from '../utils/random';
export default {
picture: () => random.pick('🎆', '🌃', '🌇', '🎇', '🌌', '🌠', '🌅', '🌉', '🏞', '🌆', '🌄', '🖼', '🗾', '🎑', '🏙', '🌁'),
color(index: number) {
const arr = [...'🔴🟠🟡🟢🔵🟣⚫️⚪️🟤'];
const arr = [...new Intl.Segmenter().segment('🔴🟠🟡🟢🔵🟣⚫️⚪️🟤')].map(x => x.segment);
index = index % arr.length;
return arr[index];
},