Skip to content

FEATURE: theme default option in user interface #34110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
FIX: specs
  • Loading branch information
lis2 committed Aug 6, 2025
commit 07e210edb6d2091c2461652b5308dc2f5da9c17d
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export function listColorSchemes(site, options = {}) {
id: -1,
name: `${i18n("user.color_schemes.default_description")}`,
colors: options.darkOnly
? defaultDarkColorScheme?.colors
: defaultLightColorScheme?.colors,
? defaultDarkColorScheme?.colors || []
: defaultLightColorScheme?.colors || [],
});

return results.length === 0 ? null : results;
Expand Down
2 changes: 1 addition & 1 deletion spec/system/interface_color_selector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
end

it "is not available if the user uses the same scheme for dark mode as the light mode" do
user.user_option.update!(color_scheme_id: light_scheme.id, dark_scheme_id: -1)
user.user_option.update!(color_scheme_id: light_scheme.id, dark_scheme_id: light_scheme.id)
sign_in(user)

visit("/")
Expand Down
1 change: 1 addition & 0 deletions spec/system/user_page/user_preferences_interface_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
before do
dark = ColorScheme.find_by(base_scheme_id: "Dark")
ColorScheme.where.not(id: dark.id).destroy_all
dark.update!(user_selectable: false)
user.user_option.update!(dark_scheme_id: dark.id, theme_ids: [SiteSetting.default_theme_id])
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@
let(:marigold_palette) { theme.color_schemes.find_by(name: "Marigold") }
let(:marigold_palette_dark) { theme.color_schemes.find_by(name: "Marigold Dark") }

before { SiteSetting.interface_color_selector = "sidebar_footer" }
before do
SiteSetting.interface_color_selector = "sidebar_footer"
SiteSetting.default_theme_id = theme.id
theme.update!(
color_scheme_id: marigold_palette.id,
dark_color_scheme_id: marigold_palette_dark.id,
)
end

it "does not show the sidebar button if there are no user-selectable color palettes" do
ColorScheme.update_all(user_selectable: false)
Expand Down
Loading