about summary refs log tree commit diff
path: root/lib/tasks
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-05-01 16:52:27 +0200
committerClaire <claire.github-309c@sitedethib.com>2022-05-01 16:52:27 +0200
commit392ca0472a50ea930f46e22dccf5ce55b04ef588 (patch)
tree9f8c6b3dcb11a620a417205f9554e8d37e5f3e12 /lib/tasks
parent252deefe3433d0cedafd973becd0d85b5182eb49 (diff)
parent33f3818d660c67194f94c7ff2bb180f4865e6748 (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `app/javascript/packs/admin.js`:
  Conflicts due to glitch-soc's theming system.
  Upstream changes have been ported to `app/javascript/core/admin.js`
- `app/models/trends/statuses.rb`:
  Minor conflict due to glitch-soc's option to allow CWed toots in trends.
  Ported upstream changes.
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/emojis.rake14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/tasks/emojis.rake b/lib/tasks/emojis.rake
index 8faa48a95..d9db79940 100644
--- a/lib/tasks/emojis.rake
+++ b/lib/tasks/emojis.rake
@@ -1,6 +1,6 @@
 # frozen_string_literal: true
 
-def gen_border(codepoint)
+def gen_border(codepoint, color)
   input = Rails.root.join('public', 'emoji', "#{codepoint}.svg")
   dest = Rails.root.join('public', 'emoji', "#{codepoint}_border.svg")
   doc = File.open(input) { |f| Nokogiri::XML(f) }
@@ -19,7 +19,7 @@ def gen_border(codepoint)
 
     border_elem.delete('fill')
 
-    border_elem['stroke'] = 'white'
+    border_elem['stroke'] = color
     border_elem['stroke-linejoin'] = 'round'
     border_elem['stroke-width'] = '4px'
 
@@ -91,12 +91,16 @@ namespace :emojis do
   desc 'Generate emoji variants with white borders'
   task :generate_borders do
     src = Rails.root.join('app', 'javascript', 'mastodon', 'features', 'emoji', 'emoji_map.json')
-    emojis = '🎱🐜⚫🖤⬛◼️◾◼️✒️▪️💣🎳📷📸♣️🕶️✴️🔌💂‍♀️📽️🍳🦍💂🔪🕳️🕹️🕋🖊️🖋️💂‍♂️🎤🎓🎥🎼♠️🎩🦃📼📹🎮🐃🏴🐞🕺📱📲🚲👽⚾🐔☁️💨🕊️👀🍥👻🐐❕❔⛸️🌩️🔊🔇📃🌧️🐏🍚🍙🐓🐑💀☠️🌨️🔉🔈💬💭🏐🏳️⚪⬜◽◻️▫️'
+    emojis_light = '👽⚾🐔☁️💨🕊️👀🍥👻🐐❕❔⛸️🌩️🔊🔇📃🌧️🐏🍚🍙🐓🐑💀☠️🌨️🔉🔈💬💭🏐🏳️⚪⬜◽◻️▫️'
+    emojis_dark = '🎱🐜⚫🖤⬛◼️◾◼️✒️▪️💣🎳📷📸♣️🕶️✴️🔌💂‍♀️📽️🍳🦍💂🔪🕳️🕹️🕋🖊️🖋️💂‍♂️🎤🎓🎥🎼♠️🎩🦃📼📹🎮🐃🏴🐞🕺📱📲🚲'
 
     map = Oj.load(File.read(src))
 
-    emojis.each_grapheme_cluster do |emoji|
-      gen_border map[emoji]
+    emojis_light.each_grapheme_cluster do |emoji|
+      gen_border map[emoji], 'black'
+    end
+    emojis_dark.each_grapheme_cluster do |emoji|
+      gen_border map[emoji], 'white'
     end
   end
 end