Run, Developer, Run!

Show Color or Black and White Emojis in different applications

Okay, this is a very specific preference. But what is Linux for, if not for working exactly according to a specific preferences?

I have mixed opinions about emojis. I find symbols as you see on the screenshot1, very useful in notes, documentation, and even terminal. But I prefer them to be rendered grayscale (screenshot left) to not stand out in the text, and look consistent with other symbols I use a lot: ←↑↓→. If you search The Internet, there will be a million advices on how to make emojis colorful. But I was not able to find a bit of info on how to make them black or white or grayscale.

To make things even more tricky, I want colorful emojis in chat applications and Spotify, but grayscale in other applications like text editors and browser.

It turns out that it is very simple to achieve if you use the right configs.

  1. First you need to figure out which font provides color emojis in your system. Most probably it is Noto Color Emoji located in /usr/share/fonts/truetype/noto/NotoColorEmoji.ttf, but you may have another one. In any case, I recommend replacing it with Apple Color Emoji for Linux. Because everything else looks u-u-ugly! 🤪
    • Changes should be visible in any application after you run sudo fc-cache -fv and restart the app
  2. After all emojis are colorful we need to blacklist the font, by creating config: ~/.config/fontconfig/fonts.conf:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE fontconfig SYSTEM "fonts.dtd">
    
    <selectfont>
        <rejectfont>
            <glob>*/.local/share/fonts/AppleColorEmoji.ttf</glob>
        </rejectfont>
    </selectfont>
    
    • Now emojis should be grayscale by default
    • If after blacklisting the font you don't see emoji at all, you need to install font with a black and white emojis like Symbola font and run sudo fc-cache -fv
  3. Now we need to create another config with same font whitelisted: ~/.config/fontconfig/fonts-color-emojis.conf:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">

<fontconfig>

    <!-- Next line is important! -->
    <include ignore_missing="yes">/etc/fonts/fonts.conf</include>
    <selectfont>
        <acceptfont>
            <glob>*/.local/share/fonts/AppleColorEmoji.ttf</glob>
        </acceptfont>
    </selectfont>
</fontconfig>
  1. After these changes by default emojis will be grayscale, but running any app with FONTCONFIG_FILE=/path/to/config eviroment variable should enable colorful emojis
    • For example FONTCONFIG_FILE=~/.config/fontconfig/fonts-color-emojis.conf spotify
    • If you need emojis to be colorful by default, just swap the acceptfont/rejectfont in the config files.


  1. And 💩 when mentioning Windows, obviously. 


Contact

Follow

Me on Twitter, Mastodon and Github

We have RSS!

© 20xx

Hosted on Cloudflare Pages, which is awesome!