Skip to content

Add password digit highlighting and settings toggle#192

Open
metergames wants to merge 2 commits into
nextcloud:masterfrom
metergames:feature/color-password-digits
Open

Add password digit highlighting and settings toggle#192
metergames wants to merge 2 commits into
nextcloud:masterfrom
metergames:feature/color-password-digits

Conversation

@metergames

@metergames metergames commented Jun 17, 2026

Copy link
Copy Markdown

This pull request introduces a new feature that allows users to highlight digits in revealed passwords with a different color, making it easier to distinguish similar-looking characters (like 0 and O). The feature can be enabled or disabled via a new setting in the app's settings screen. The implementation includes changes to the password display logic, user preferences, and the user interface.

Closes #191

Password Display Enhancements

  • Added logic in CopyTextItem to highlight digits in revealed passwords using a custom color (password_digit) when the new setting is enabled. This is handled by the new refreshDisplayedText method, which applies a ForegroundColorSpan to digits. [1] [2] [3] [4] [5]

Settings and Preferences

  • Introduced a new setting value COLOR_PASSWORD_DIGITS in SettingValues to control whether password digits are highlighted.
  • Updated SettingsFragment to include a new checkbox (settings_color_password_digits_switch) for enabling/disabling the digit-highlighting feature, and to persist the user's preference. [1] [2] [3] [4]
  • Updated the settings layout (fragment_settings.xml) to add the checkbox and its descriptive label.

User Interface and Localization

  • Added new string resources for the setting's label and description, and defined the color used for highlighting digits. [1] [2]

Render numeric digits in a distinct blue color when a password is revealed in CopyTextItem, so visually similar characters (e.g. 0 vs O, 1 vs l) can be told apart. Coloring is applied only while the password is shown - not while masked - so it never reveals digit positions behind the masking dots. Covers both the main password field and password-type custom fields, since both use CopyTextItem. Gated by a new COLOR_PASSWORD_DIGITS preference that defaults to on.
Signed-off-by: Ryan Morov <metergames22@gmail.com>
Add a checkbox in settings to enable or disable highlighting of digits in revealed passwords. Defaults to enabled. Wires the COLOR_PASSWORD_DIGITS preference through SettingsFragment and adds the corresponding strings.
Signed-off-by: Ryan Morov <metergames22@gmail.com>
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.

Highlight digits in a different color when viewing a password

1 participant