mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 22:37:37 +08:00
FEATURE: Add email dark mode (#16104)
implement dark mode emails when `SiteSetting.dark_mode_emails_active` is active.
This commit is contained in:
@ -238,6 +238,7 @@ module Email
|
||||
|
||||
onebox_styles
|
||||
plugin_styles
|
||||
dark_mode_styles if SiteSetting.dark_mode_emails_active
|
||||
|
||||
style('.post-excerpt img', "max-width: 50%; max-height: #{MAX_IMAGE_DIMENSION}px;")
|
||||
|
||||
@ -333,6 +334,16 @@ module Email
|
||||
|
||||
private
|
||||
|
||||
def dark_mode_styles
|
||||
# When we ship the email template and its styles we strip all css classes so to give our
|
||||
# dark mode styles we are including in the template a selector we add a data-attr of 'dm=value' to
|
||||
# the appropriate place
|
||||
style(".digest-header, .digest-topic, .digest-topic-body, .digest-topic-title-wrapper, .digest-topic-stats, .popular-post-excerpt", nil, dm: "header")
|
||||
style(".digest-content, .header-popular-posts, .spacer, .popular-post-spacer, .popular-post-meta, .digest-new-header, .digest-new-topic, .body", nil, dm: "body")
|
||||
style(".with-accent-colors, .digest-content-header", nil, dm: "body_primary")
|
||||
style(".summary-footer", nil, dm: "text-color")
|
||||
end
|
||||
|
||||
def replace_relative_urls
|
||||
forum_uri = URI(Discourse.base_url)
|
||||
host = forum_uri.host
|
||||
|
Reference in New Issue
Block a user