Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grey out emoji characters (HTML / CSS)

My current issue is that I am trying to grey out a button with emojis in it.

Nevertheless it seems that, due the nature of emojis, it is not possible to change the color using HTML / CSS properties.

I.e.:

<button disabled> 🎨_myText </button>

<p style="color:grey">
  👎_myText2
</p>
like image 589
plmk Avatar asked Mar 18 '19 11:03

plmk


People also ask

How do I use Emojis in CSS?

Emojis in CSS All you have to do is remove the U+ from the unicode endpoint and add the \0 (slash zero) characters just before it.

What is the HTML code for Emojis?

Emoji Characters Emojis are also characters from the UTF-8 alphabet: 😄 is 128516. 😍 is 128525. 💗 is 128151.

How do you render Emojis in HTML?

Emojis can be inserted in HTML documents by specifying charset to UTF-8 that will be used while displaying the web pages in the browser. This character encoding information is specified by using <meta> tag in the head section. After declaration of charset, emojis can be added in HTML by using <p> and <span> tags.


2 Answers

If you're looking to just change the Emoji colour to grey, you can do so using filter: grayscale:

<button style="filter: grayscale(100%);" disabled>&#127912;_myText</button>

<p style="color:grey; filter: grayscale(100%);">&#128078;_myText2</p>

As a side note, I suggest you use HTML entities for representing Emojis. Not all text editors support Emojis and so they may become corrupt if opened in one. You can use this unicode lookup to find the HTML entity version of your Unicode characters.

If you wish to colour your Emojis in other colours see this answer

like image 116
Nick Parsons Avatar answered Oct 06 '22 01:10

Nick Parsons


You can use text shadow

 <button disabled> 🎨_myText </button>

    <p style="color:transparent; text-shadow: 0 0 0 grey;">
      👎_myText2
    </p>
like image 38
Amit Avatar answered Oct 06 '22 01:10

Amit