forgejo/web_src/js
silverwind 9934931f1f
[PORT] gitea##30237: Fix and rewrite contrast color calculation, fix project-related bugs
1. The previous color contrast calculation function was incorrect at
least for the `#84b6eb` where it output low-contrast white instead of
black. I've rewritten these functions now to accept hex colors and to
match GitHub's calculation and to output pure white/black for maximum
contrast. Before and after:
<img width="94" alt="Screenshot 2024-04-02 at 01 53 46"
src="https://github.com/go-gitea/gitea/assets/115237/00b39e15-a377-4458-95cf-ceec74b78228"><img
width="90" alt="Screenshot 2024-04-02 at 01 51 30"
src="https://github.com/go-gitea/gitea/assets/115237/1677067a-8d8f-47eb-82c0-76330deeb775">

2. Fix project-related issues:

- Expose the new `ContrastColor` function as template helper and use it
for project cards, replacing the previous JS solution which eliminates a
flash of wrong color on page load.
- Fix a bug where if editing a project title, the counter would get
lost.
- Move `rgbToHex` function to color utils.

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Giteabot <teabot@gitea.io>

---
Conflict resolution: Trivial.
(cherry picked from commit 36887ed3921d03f1864360c95bd2ecf853bfbe72)
(cherry picked from commit f6c0c39f1a)
2024-05-14 15:50:47 +02:00
..
components [PORT] gitea##30237: Fix and rewrite contrast color calculation, fix project-related bugs 2024-05-14 15:50:47 +02:00
features [PORT] gitea##30237: Fix and rewrite contrast color calculation, fix project-related bugs 2024-05-14 15:50:47 +02:00
markup Migrate gt-hidden to tw-hidden (#30046) 2024-03-30 07:17:29 +01:00
modules Add form field id generation, remove duplicated ids (#30546) 2024-04-22 07:46:30 +00:00
render Use vitest globals (#27102) 2023-09-27 04:37:13 +00:00
standalone lint: apply lint-frontend-fix 2024-03-26 19:04:28 +01:00
utils [PORT] gitea##30237: Fix and rewrite contrast color calculation, fix project-related bugs 2024-05-14 15:50:47 +02:00
vendor Vendor jquery.are-you-sure with strict mode fixes (#26901) 2023-09-06 00:02:44 +00:00
webcomponents Move settings button back to the right in repo and org header 2024-04-28 06:21:47 +00:00
bootstrap.js Fix JS error and improve error message styles (#29963) 2024-03-26 19:04:26 +01:00
bootstrap.test.js Avoid duplicate JS error messages on UI (#28873) 2024-01-21 14:23:08 +00:00
htmx.js Auto-update the system status in admin dashboard (#29163) 2024-02-17 23:24:31 +01:00
index.js When the title in the issue has a value, set the text cursor at the end of the text. (#30090) 2024-03-30 07:17:31 +01:00
jquery.js Forbid variables containing jQuery collections not having the $ prefix (#29839) 2024-03-20 08:46:30 +01:00
svg.js Update JS any PY dependencies, remove workarounds (#30085) 2024-03-30 07:17:30 +01:00
svg.test.js Use vitest globals (#27102) 2023-09-27 04:37:13 +00:00
utils.js enforce maxlength in frontend (#29389) 2024-02-26 22:30:27 +01:00
utils.test.js Use vitest globals (#27102) 2023-09-27 04:37:13 +00:00
vitest.setup.js [BUG] Render emojis in labels in issue info popup 2024-03-30 14:31:06 +00:00