about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorGaelan Steele <gbs@canishe.com>2022-04-29 18:23:03 +0100
committerGitHub <noreply@github.com>2022-04-29 19:23:03 +0200
commit74e20f22cd93ec1fd5e325bd333d417f4d88f7f4 (patch)
treef496a44d4726c3b2d67196b9ce1089b348dee817 /lib
parent6726d2933a25137f8dce639c53da8aa1752be47e (diff)
Fix light-mode emoji borders. (#18131)
Diffstat (limited to 'lib')
-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