Emoji Fluff

:discourse2: Summary Adds optional variations or animations to emojis.
:eyeglasses: Preview Preview on theme-creator.discourse.org
:hammer_and_wrench: Repository Link https://github.com/arkshine/discourse-emoji-fluff
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install this theme component

:information_source: This component requires Discourse to be current as of 2024-11-26T23:00:00Z. [1]

Description

Emoji Fluff allows users to put mirrored or animated emojis in their posts.
It allows users to post fancy emoji work such as:

flexing emoji

You can choose these decorations from the emoji autocompletion pop-up, from the emoji picker, or by appending keywords directly after the emoji shortcode:

Examples: :bike:f-slide , :smile:f-bounce

Horizontal and vertical flips can be combined with other decorations.

Examples:

  • :horse:f-slide,flip:
  • :spider:f-float,flip_v:

Screenshots

Available emoji fluff

Fluff list

How to add fluff to an emoji

From the emoji autocompletion pop-up

fluff autocompletion

From the emoji picker

Fluff emoji picker

By typing manually the fluff suffix

Fluff suffix

Features

  • Horizontally or vertically mirrored emojis

  • Animated emojis (bounce, rotate, pulse, etc)

  • Setting to choose which emoji decorations should be available to users

  • Setting to choose inserting a decorations selector in autocomplete or emoji picker.

  • Allow admins to create new fluffs

Settings

Setting Description
enabled Turn on or off the component’s functionalities.
Default value: true
Disabling will prevent the emoji decoration from being applied.
This is useful if you want to pause or plan to remove the component but don’t want to see the decoration code, such as :slightly_smiling_face:spin:, in posts.
For more information, check out Reverting emoji decorations in the topic.
allow decorations List of allowed decorations.
Default value: flip|flip_v|spin|pulse|bounce|wobble|float|slide|fade|negative|hue|gray
allow selector in Where the fluff selector should be available.
Default value: both
none – disable the selectors.
both – enable the selector in the autocomplete and the emoji picker.
autocomplete – enable the selector only in the autocomplete.
emoji-picker – enable the selector only in the emoji picker.

:earth_africa: Additionally, the theme component strings are translatable from the settings.

Reverting emoji decorations

If you disable the component, these suffixes remain, resulting in emojis like this: :smile:f-spin:

Due to theme component limitations and design choices, we add straightforward suffixes to emojis to give them these decorative effects. The fluff prefix f- helps identify these decorations, making them easy to remove through the script available below.

You can download and run a rake task to remove fluff suffixes definitely from posts.

wget -P lib/tasks/ https://raw.githubusercontent.com/Arkshine/discourse-emoji-fluff/refs/heads/main/tasks/fluff.rake
rake fluff:delete_all

:information_source: The rake task doesn’t create post revisions by default. You can add false as an argument to change this behavior: rake fluff:delete_all[false]

Read Administrative Bulk Operations for instructions on entering the container to run the rake task.

:warning: Always make a backup before running this task. There is no guarantee that it won’t remove unwanted strings. Use it at your own risk, and review the code if in doubt.

Creating your fluffs

Fluff creation requires CSS knowledge.

When a fluff is added to an emoji inside a post, the emoji is wrapped by a <span> tag with a fluff class:

<span class="fluff fluff--bounce">
  <img src="https://your.discourse.com/images/emoji/twitter/kangaroo.png?v=12" title=":kangaroo:" class="emoji" alt=":kangaroo:" loading="lazy" width="20" height="20" style="aspect-ratio: 20 / 20;">
</span>

Add custom CSS to your theme or a new theme component to add new fluffs.
Here are two examples of new fluff:

Tilt 90° an emoji

Emoji tilt

.fluff--tilt img {
  transform: rotate(90deg);
}

Do a 3D spin effect

Emoji 3D spin

.fluff--spin3d img {
  animation: f-spin3d 2s infinite linear;
}

@keyframes f-spin3d {
  0% {
    transform: perspective(50em) rotateY(0deg);
    filter: brightness(1);
  }
  50% {
    transform: perspective(50em) rotateY(90deg);
    filter: brightness(0.85);
  }
  51% {
    transform: perspective(50em) rotateY(91deg);
    filter: brightness(1.15);
  }
  100% {
    transform: perspective(50em) rotateY(180deg);
    filter: brightness(1);
  }
}

Then, you need to add the fluff suffix in the Emoji Fluff allowed decorations:

That’s all; your new fluffs should now be available to users. Enjoy!

Credit

  • @Canapin: Original idea, general help preparing and testing this TC.

  1. To be precise, TC requires at least a Discourse version after October 30, and specifically the support of emoji picker, a current version as of 2024-11-26T23:00:00Z (thanks to the team for adding a plugin outlet a few days ago!) ↩︎

24 Likes

haha this is awesome! très bien! :star_struck:

9 Likes

I have a feeling that it conflicts with this component Omit Emoji component causing the UI for the one that selects the emoji to not show the component’s magic wand


2 Likes

I don’t use that component, but I’m using iPad and drafting has done that couple times now — I’m writing a help for users. Publishing fixes it.

2 Likes

This is amazing! Well done!! :star_struck:

(small nitpick, would “negative” be a better description than “invert”?)

4 Likes

Did you update Discourse? You only receive a notification to update when a new beta is released, but new commits are added every day.

4 Likes

Thanks! :smile:

You’re right; it has been renamed now!

As stated by Moin, you will need to update Discourse.
I looked at the Theme component code and tested it; once you update Discourse, they should work together without issues! :+1:

8 Likes