Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to get the majority color of an emoji?

What I'm trying to achieve is adding a text-shadow to an emoji with the text-shadow color being the most prominent color in the emoji.

I know there are JavaScript libraries that identify the most prominent color in images, but since the emoji is technically text I'm not sure how I'd do it or even if it's possible at all.

I would provide some code for what I've already tried, but quite honestly, I wouldn't even know where to start.

.emoji {
  text-shadow: 0px 0px 20px rgba(54, 169, 230, 0.65);
  padding: 3px 6px;
  font-size: 24px;
}
<span class="emoji">💎</span>
like image 222
Simon Avatar asked Apr 24 '18 23:04

Simon


People also ask

How do I get different color emojis?

Tap the smiley icon on the bottom corner. Choose an emote from the emoticon library. Long press the emoji for the emojis color options to appear. Choose from the skin colors available.

Why are all emojis yellow?

- Yellow colour is said to represent happiness. - The details of the face are clearly visible in yellow colour, wherein emojis and smileys are able to show very clear emotions.

Why is my emoji black and white?

If you have an emoji inside of a bold text element, the emoji will show up monochrome/black & white instead of its normal colour. Hopefully they release a fix soon because otherwise we'll need to go back and find every emoji we've used in a heading or bold button.

Why can't I change the skin color of my emojis?

This is by right-clicking on the emoji in the message body itself and select the skin color in the provided options.


1 Answers

An alternative approach without using text-shadow is to copy the emoji, place it directly behind the original and blur it.

You could create the copy directly in the HTML, or if easier use js, as in the example below.

var emoji = document.querySelector("#blur-me");
var copy = emoji.cloneNode(true);
copy.classList.remove("emoji");
emoji.appendChild(copy);
.emoji {
  padding: 3px 6px;
  font-size: 24px;
  position: relative;
  display: inline-block;
}

.emoji span {
  position: absolute;
  left: 6px;
  z-index: -1;
  filter: blur(10px);
}
<span class="emoji" id="blur-me">💎</span>
like image 144
sol Avatar answered Oct 03 '22 07:10

sol