Skip to content

Fix #56818: Toggle 2FA icons based on theme light/dark mode#59268

Open
carolinafquinteiro wants to merge 1 commit intonextcloud:masterfrom
carolinafquinteiro:fix/2fa-icons-visibility
Open

Fix #56818: Toggle 2FA icons based on theme light/dark mode#59268
carolinafquinteiro wants to merge 1 commit intonextcloud:masterfrom
carolinafquinteiro:fix/2fa-icons-visibility

Conversation

@carolinafquinteiro
Copy link
Copy Markdown

@carolinafquinteiro carolinafquinteiro commented Mar 27, 2026

The 2FA setup and backup code icons were not adapting correctly to different themes, leading to visibility issues.

This fix replaces the single static icon with two separate icons: .two-factor-icon-light and .two-factor-icon-dark. It introduces a new SCSS file to toggle visibility based on:

  • The 'data-themes' attribute on the body (manual selection).
  • The 'prefers-color-scheme' media query (system default theme).

Changes:

  • Modified 2FA PHP templates to include light and dark SVG versions.
  • Added twofactor-icons.scss to handle display:none/inline logic.
  • Registered the new stylesheet in the relevant 2FA views.

Summary

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

The 2FA setup and backup code icons were not adapting correctly to
different themes, leading to visibility issues.

This fix replaces the single static icon with two separate icons:
.two-factor-icon-light and .two-factor-icon-dark. It introduces
a new SCSS file to toggle visibility based on:
- The 'data-themes' attribute on the body (manual selection).
- The 'prefers-color-scheme' media query (system default theme).

Changes:
- Modified 2FA PHP templates to include light and dark SVG versions.
- Added twofactor-icons.scss to handle display:none/inline logic.
- Registered the new stylesheet in the relevant 2FA views.

Signed-off-by: Carolina Quinteiro <carolinafquinteiro@tecnico.ulisboa.pt>
@carolinafquinteiro carolinafquinteiro requested review from nfebe, sorbaugh and susnux and removed request for a team March 27, 2026 17:21
Copy link
Copy Markdown
Contributor

@susnux susnux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for your contribution!

One question about the implementation:
Why not simplify by just assign this stlye to the icon:

filter: var(--background-invert-if-dark);

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.

[Bug]: The icons for 2FA providers remain white regardless of whether the theme is dark or light

2 participants