Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to style a unicode character? [duplicate]

I would like to style the unicode character DROPLET (💧), specifically change the blue color to something else.

.red {
  color: red;
  background-color: yellow;
}
<span class="red">DROPLET 💧</span>

The yellow style is applied but not the color of the character (the text is correctly styled).

Is styling any unicode glyph possible?

like image 632
WoJ Avatar asked Oct 18 '19 12:10

WoJ


People also ask

How do I type Unicode characters in word?

To do this, just type the hexadecimal code of the character into a Word document and then press ALT + C (in dialog boxes ALT + X). Then automatically the required Unicode character appears. The same shortcut can also be used to display the code of the character that comes before the cursur.

What is the Unicode character number and HTML-code?

Each Unicode character has its own number and HTML-code. Example: Cyrillic capital letter Э has number U+042D (042D – it is hexadecimal number), code &#1098;. In a table, letter Э located at intersection line no. 0420 and column D. If you want to know number of some symbol, you may found it in a table.

Is there a symbol for cut and paste in Unicode?

So unless there is a character commonly used in texts to symbolize cut and paste, you shouldn’t expect to find such a symbol in Unicode. U+2702 BLACK SCISSORS is in Unicode since it appears in older character codes, and it has been used in printed documents to indicate a cutting line, as a “cut here” indicator, rather than as a symbol of copying.

How to find Unicode symbol number?

Unicode symbols. Each Unicode character has its own number and HTML-code. Example: Cyrillic capital letter Э has number U+042D (042D – it is hexadecimal number), code ъ. In a table, letter Э located at intersection line no. 0420 and column D. If you want to know number of some Unicode symbol, you may found it in a table.


1 Answers

You can try with filter

.red {
  color: red;
  background-color: yellow;
}
.red > span {
   filter: hue-rotate(180deg) saturate(10);
}
<span class="red">DROPLET <span>💧</span></span>

Or mix-blend-mode but this will also affect the background:

.red {
  background:#fff;
  position:relative;
  display:inline-block;
}
.red > span {
  filter:brightness(0); /* We make the icon black */
}
.red:before {
   content:"";
   position:absolute;
   top:0;
   left:0;
   right:0;
   bottom:0;
   background:red;
   pointer-events:none;
   mix-blend-mode:lighten; /* this will make the icon red since red is more "light" than black*/
    z-index: 1;
}
<span class="red">DROPLET <span>💧</span></span>
like image 176
Temani Afif Avatar answered Oct 08 '22 10:10

Temani Afif