Update theme_color_tags helper for new theme infrastructure (#37519)
This commit is contained in:
1 parent
be00db4fa3
commit
e58084a85f
3 files changed
+17
-18
No files matched your search
@@ -28,14 +28,17 @@ module ThemeHelper
|
||||
end
|
||||
end
|
||||
|
||||
def theme_color_tags(theme)
|
||||
if theme == 'system'
|
||||
def theme_color_tags(color_scheme)
|
||||
case color_scheme
|
||||
when 'auto'
|
||||
''.html_safe.tap do |tags|
|
||||
tags << tag.meta(name: 'theme-color', content: Themes::THEME_COLORS[:dark], media: '(prefers-color-scheme: dark)')
|
||||
tags << tag.meta(name: 'theme-color', content: Themes::THEME_COLORS[:light], media: '(prefers-color-scheme: light)')
|
||||
end
|
||||
else
|
||||
tag.meta name: 'theme-color', content: theme_color_for(theme)
|
||||
when 'light'
|
||||
tag.meta name: 'theme-color', content: Themes::THEME_COLORS[:light]
|
||||
when 'dark'
|
||||
tag.meta name: 'theme-color', content: Themes::THEME_COLORS[:dark]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -65,8 +68,4 @@ module ThemeHelper
|
||||
Setting.custom_css&.then { |content| Digest::SHA256.hexdigest(content) }
|
||||
end
|
||||
end
|
||||
|
||||
def theme_color_for(theme)
|
||||
theme == 'mastodon-light' ? Themes::THEME_COLORS[:light] : Themes::THEME_COLORS[:dark]
|
||||
end
|
||||
end
|
||||
@@ -21,7 +21,7 @@
|
||||
%link{ rel: 'mask-icon', href: frontend_asset_path('images/logo-symbol-icon.svg'), color: '#6364FF' }/
|
||||
%link{ rel: 'manifest', href: manifest_path(format: :json) }/
|
||||
= javascript_inline_tag 'theme-selection.js'
|
||||
= theme_color_tags current_theme
|
||||
= theme_color_tags color_scheme
|
||||
%meta{ name: 'mobile-web-app-capable', content: 'yes' }/
|
||||
|
||||
%title= html_title
|
||||
|
||||
Reference in new issue
Block a user