mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:38:39 +08:00

This commit makes the [color-scheme-toggle](https://github.com/discourse/discourse-color-scheme-toggle) theme component a core feature with improvements and bug fixes. The theme component will be updated to become a no-op if the core feature is enabled. Noteworthy changes: * the color mode selector has a new "Auto" option that makes the site render in the same color mode as the user's system preference * the splash screen respects the color mode selected by the user * dark/light variants of category logos and background images are now picked correctly based on the selected color mode * a new `interface_color_selector` site setting to disable the selector or choose its location between the sidebar footer or header Internal topic: t/139465. --------- Co-authored-by: Ella <ella.estigoy@gmail.com>
20 lines
512 B
Ruby
20 lines
512 B
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Components
|
|
class HomeLogo < PageObjects::Components::Base
|
|
def has_dark_logo_forced?
|
|
has_css?(".title picture source[media=\"all\"]", visible: false)
|
|
end
|
|
|
|
def has_light_logo_forced?
|
|
has_css?(".title picture source[media=\"none\"]", visible: false)
|
|
end
|
|
|
|
def has_auto_color_mode?
|
|
has_css?(".title picture source[media=\"(prefers-color-scheme: dark)\"]", visible: false)
|
|
end
|
|
end
|
|
end
|
|
end
|