diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d2078d15eb8..96d3c11a659 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -626,13 +626,16 @@ module ApplicationHelper end def discourse_theme_color_meta_tags - result = +<<~HTML - - HTML + result = +"" if dark_scheme_id != -1 result << <<~HTML + HTML + else + result << <<~HTML + + HTML end result.html_safe end diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 8b3ae785ccc..e00f88c5eaf 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -753,9 +753,9 @@ RSpec.describe ApplicationHelper do helper.request.cookies["dark_scheme_id"] = dark.id end - it "renders theme-color meta for the light scheme with media=all and another one for the dark scheme with media=(prefers-color-scheme: dark)" do + it "renders theme-color meta for the light scheme with media=(prefers-color-scheme: light) and another one for the dark scheme with media=(prefers-color-scheme: dark)" do expect(helper.discourse_theme_color_meta_tags).to eq(<<~HTML) - + HTML end