fix: simplify emoji color check algorithm (#139)

* fix: simplify emoji color check algorithm

* fix: clarify code comment
This commit is contained in:
Nolan Lawson 2021-05-31 10:28:21 -07:00 committed by GitHub
parent f6f5d93780
commit ff6865ce85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 6 deletions

View File

@ -1,5 +1,12 @@
// Find one good representative emoji to test. Ideally it should have color in the center.
// For some inspiration, see: https://about.gitlab.com/blog/2018/05/30/journey-in-native-unicode-emoji/
// Find one good representative emoji from each version to test by checking its color.
// Ideally it should have color in the center. For some inspiration, see:
// https://about.gitlab.com/blog/2018/05/30/journey-in-native-unicode-emoji/
//
// Note that for certain versions (12.1, 13.1), there is no point in testing them explicitly, because
// all the emoji from this version are compound-emoji from previous versions. So they would pass a color
// test, even in browsers that display them as double emoji. (E.g. "face in clouds" might render as
// "face without mouth" plus "fog".) These emoji can only be filtered using the width test,
// which happens in checkZwjSupport.js.
export const versionsAndTestEmoji = {
'😃': 0.6,
'😐️': 0.7,
@ -9,8 +16,6 @@ export const versionsAndTestEmoji = {
'👱‍♀️': 4,
'🤩': 5,
'🥰': 11, // smiling face with hearts
'🥻': 12, // sari
'🧑‍🦰': 12.1, // person: red hair
'🥲': 13, // smiling face with tear
'😵‍💫': 13.1 // face with spiral eyes
'🥻': 12.1, // sari, technically from v12 but see note above
'🥲': 13.1 // smiling face with tear, technically from v13 but see note above
}