Skip to content

Add persisted user-selectable light/dark theme with settings toggle#48

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-dark-mode-settings
Draft

Add persisted user-selectable light/dark theme with settings toggle#48
Copilot wants to merge 2 commits intomainfrom
copilot/add-dark-mode-settings

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 17, 2026

This adds a per-user dark mode with light as the default and places the theme switch in Settings. The selected mode is now persisted and applied on subsequent requests.

  • Theme persistence in Accounts

    • Added theme_preference to members with allowed values :light | :dark and default :light.
    • Updated Member changeset casting so settings updates can persist theme choice.
    • Added migration:
      • priv/repo/migrations/20260417213600_add_theme_preference_to_members.exs
  • Settings UI toggle

    • Added a dedicated Theme section in settings_html/edit.html.heex.
    • Implemented a Bootstrap switch (Use dark mode) that submits dark when enabled and light when disabled.
  • Global theme application

    • Updated root layout to set Bootstrap theme on <html> via data-bs-theme based on current_member.theme_preference.
    • Non-authenticated/default behavior remains light mode.
  • Coverage for new behavior

    • Added controller tests for settings rendering and persistence of dark mode.
    • Extended accounts tests to verify update_member/2 updates theme_preference.
<html
  lang="en"
  data-bs-theme={if(assigns[:current_member] && assigns[:current_member].theme_preference == :dark, do: "dark", else: "light")}
>

Copilot AI linked an issue Apr 17, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add dark mode toggle to user settings Add persisted user-selectable light/dark theme with settings toggle Apr 17, 2026
Copilot AI requested a review from kristofer April 17, 2026 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add a dark mode.

2 participants