ac28635d0f5c5bf4ca1ba5887221719af342dd55
[akkoma] / docs / config / custom_emoji.md
1 # Custom Emoji
2
3 Before you add your own custom emoji, check if they are available in an existing pack.
4 See `Mix.Tasks.Pleroma.Emoji` for information about emoji packs.
5
6 To add custom emoji:
7 * Create the `STATIC-DIR/emoji/` directory if it doesn't exist
8 (`STATIC-DIR` is configurable, `instance/static/` by default)
9 * Create a directory with whatever name you want (custom is a good name to show the purpose of it).
10 This will create a local emoji pack.
11 * Put your `.png` emoji files in that directory. In case of conflicts, you can create an `emoji.txt`
12 file in that directory and specify a custom shortcode using the following format:
13 `shortcode, file-path, tag1, tag2, etc`. One emoji per line. Note that if you do so,
14 you'll have to list all other emojis in the pack too.
15 * Either restart pleroma or connect to the iex session pleroma's running and
16 run `Pleroma.Emoji.reload/0` in it.
17
18 Example:
19
20 image files (in `instance/static/emoji/custom`): `happy.png` and `sad.png`
21
22 content of `emoji.txt`:
23 ```
24 happy, /emoji/custom/happy.png, Tag1,Tag2
25 sad, /emoji/custom/sad.png, Tag1
26 foo, /emoji/custom/foo.png
27 ```
28
29 The files should be PNG (APNG is okay with `.png` for `image/png` Content-type) and under 50kb for compatibility with mastodon.
30
31 ## Emoji tags (groups)
32
33 Default tags are set in `config.exs`. To set your own tags, copy the structure to your secrets file (`prod.secret.exs` or `dev.secret.exs`) and edit it.
34 ```elixir
35 config :pleroma, :emoji,
36 shortcode_globs: ["/emoji/custom/**/*.png"],
37 groups: [
38 Finmoji: "/finmoji/128px/*-128.png",
39 Custom: ["/emoji/*.png", "/emoji/custom/*.png"]
40 ]
41 ```
42
43 Order of the `groups` matters, so to override default tags just put your group on top of the list. E.g:
44 ```elixir
45 config :pleroma, :emoji,
46 shortcode_globs: ["/emoji/custom/**/*.png"],
47 groups: [
48 "Finmoji special": "/finmoji/128px/a_trusted_friend-128.png", # special file
49 "Cirno": "/emoji/custom/cirno*.png", # png files in /emoji/custom/ which start with `cirno`
50 "Special group": "/emoji/custom/special_folder/*.png", # png files in /emoji/custom/special_folder/
51 "Another group": "/emoji/custom/special_folder/*/.png", # png files in /emoji/custom/special_folder/ subfolders
52 Finmoji: "/finmoji/128px/*-128.png",
53 Custom: ["/emoji/*.png", "/emoji/custom/*.png"]
54 ]
55 ```
56
57 Priority of tags assigns in emoji.txt and custom.txt:
58
59 `tag in file > special group setting in config.exs > default setting in config.exs`
60
61 Priority for globs:
62
63 `special group setting in config.exs > default setting in config.exs`