postcss-color-emoji
Version:
91 lines (63 loc) • 2.25 kB
Markdown
> &
[![NPM Version][npm-img]][npm-url]
[![Build Status][ci-img]][ci-url]
[![Dependency Status][david-img]][david-url]
Depending on the font, some emojis are rendered as their text variation instead of the colored version you know and love. This [PostCSS][postcss] plugin gives you full access to the system emojis on macOS, Windows, and Linux.
```css
/* Input */
.example {
font-family: color-emoji;
}
```
```css
/* Output */
.example {
font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
}
```
Check out the <a href="https://philipbordallo.github.io/postcss-color-emoji/">visual test</a>.
```sh
npm install --save-dev postcss postcss-color-emoji
yarn add --dev postcss postcss-color-emoji
```
Add it to your PostCSS work-flow, [whatever way you choose to](https://github.com/postcss/postcss#usage).
```js
// Using a postcss.config.js
const colorEmoji = require('postcss-color-emoji');
module.exports = {
plugins: [
colorEmoji
]
};
```
Then use the `color-emoji` font-family name where ever you need it.
```css
.one {
font-family: sans-serif, color-emoji;
}
```
```css
/* Using custom properties */
:root {
--emoji: color-emoji;
}
.two {
font: var(--emoji);
}
```
- Nick Galbreath for his article on the [CSS Color emoji stack](https://www.client9.com/css-color-emoji-stack/)
- Mark Dotto for his piece on [shipping system fonts to GitHub.com](http://markdotto.com/2018/02/07/github-system-fonts/)
[]: https://img.shields.io/david/philipbordallo/postcss-color-emoji.svg
[]: https://david-dm.org/philipbordallo/postcss-color-emoji
[]: https://img.shields.io/github/workflow/status/philipbordallo/postcss-color-emoji/Continuous%20Integration
[]: https://github.com/philipbordallo/postcss-color-emoji/actions/workflows/ci.yml
[]: https://img.shields.io/npm/v/postcss-color-emoji.svg
[]: https://www.npmjs.com/package/postcss-color-emoji
[]: https://github.com/postcss/postcss