Skip to content

fix: Improve image captcha contrast for dark mode#36265

Merged
silverwind merged 4 commits intogo-gitea:mainfrom
majiayu000:fix-36255-image-captcha-results-in-low-c-1230-1417
Jan 24, 2026
Merged

fix: Improve image captcha contrast for dark mode#36265
silverwind merged 4 commits intogo-gitea:mainfrom
majiayu000:fix-36255-image-captcha-results-in-low-c-1230-1417

Conversation

@majiayu000
Copy link
Contributor

Summary

This PR fixes #36255

The image captcha was using random colors which often resulted in poor contrast against dark backgrounds, making it difficult or impossible for users to read in dark mode.

Changes

  • Added a custom color palette to the image captcha configuration in services/context/captcha.go
  • The palette uses high-contrast colors (bright red, blue, green, yellow, purple, and dark blue-gray) that provide good visibility in both light and dark themes
  • This improves accessibility and user experience without changing any existing functionality

Testing

  • Builds successfully
  • All existing tests pass
  • The color palette is properly supported by the upstream gitea.com/go-chi/captcha library

Generated with Claude Code

The image captcha was using random colors which often resulted
in poor contrast against dark backgrounds, making it difficult
or impossible for users to read in dark mode.

This fix configures a color palette with high-contrast colors
that provide good visibility in both light and dark themes,
improving accessibility and user experience.

Fixes go-gitea#36255

Signed-off-by: majiayu000 <1835304752@qq.com>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 30, 2025
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Dec 30, 2025
Copy link
Member

@silverwind silverwind left a comment

Choose a reason for hiding this comment

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

LGTM, sorry it appears we missed this PR.

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jan 24, 2026
@silverwind
Copy link
Member

Because this was generated by AI, I gave it a test. Dark blue was too dark for dark mode, I removed it. Other colors are fine in both modes.

Screenshot 2026-01-24 at 02 43 37 Screenshot 2026-01-24 at 02 39 46 Screenshot 2026-01-24 at 02 44 55 Screenshot 2026-01-24 at 02 45 01

@majiayu000
Copy link
Contributor Author

@silverwind Thanks for the review and change!

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jan 24, 2026
@silverwind silverwind added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jan 24, 2026
@silverwind silverwind enabled auto-merge (squash) January 24, 2026 04:49
@silverwind silverwind merged commit 4ed43c2 into go-gitea:main Jan 24, 2026
24 checks passed
@GiteaBot GiteaBot added this to the 1.26.0 milestone Jan 24, 2026
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jan 24, 2026
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jan 26, 2026
* giteaofficial/main:
  Normalize guessed languages for code highlighting (go-gitea#36450)
  Add `knip` linter (go-gitea#36442)
  Fix various bugs (go-gitea#36446)
  Update tool dependencies (go-gitea#36445)
  Update JS dependencies, adjust webpack config, misc fixes (go-gitea#36431)
  fix: Improve image captcha contrast for dark mode (go-gitea#36265)
  Refactor template render (go-gitea#36438)
  Add documentation for markdown anchor post-processing (go-gitea#36443)
  Fix markup heading parsing, fix emphasis parsing (go-gitea#36284)
  Front port changelog for 1.25.4 (go-gitea#36432)
  Bugfix: Potential incorrect runID in run status update (go-gitea#36437)
  Restrict branch naming when new change matches with protection rules (go-gitea#36405)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Image captcha results in low contrast challenge in dark mode

4 participants