问题
My code:
let myemoji = "\u{2049}"
let another = "\u{2757}"
Playground result:
The Unicode U+2049 does not produce a red colored emoji like this ⁉️. Is there anything specific to be added for this color?
回答1:
Some characters can be displayed "as text" or "as emoji", and a "Unicode VARIATION SELECTOR" can be used to control the presentation. Example:
print("text presentation: \u{2049} \u{25B6}")
print("emoji presentation: \u{2049}\u{FE0F} \u{25B6}\u{FE0F}")
Result:
For more information, see 1.4.3 Emoji and Text Presentation Sequences:
ED-8. text presentation selector — The character U+FE0E VARIATION SELECTOR-15, used to request a text presentation for an emoji character. (Also known as text variation selector in prior versions of this specification.)
ED-9. emoji presentation selector — The character U+FE0F VARIATION SELECTOR-16, used to request an emoji presentation for an emoji character. (Also known as emoji variation selector in prior versions of this specification.)
or Variation Selector-16:
An invisible codepoint which specifies that the preceding character should be displayed with emoji presentation. Only required if the preceding character defaults to text presentation.
来源:https://stackoverflow.com/questions/48534667/how-to-display-a-colored-emoji