forgejo/templates
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
..
admin Fix admin notice view-detail (#30450) (#30458) 2024-04-15 16:41:44 +02:00
api/packages/pypi Update templates/api/packages/pypi/simple.tmpl 2024-04-12 22:23:58 +00:00
base Migrate gt-hidden to tw-hidden (#30046) 2024-03-30 07:17:29 +01:00
custom [FEAT] Repository flags 2024-02-05 16:09:42 +01:00
devtest Add svg linter and fix incorrect svgs (#30086) 2024-03-30 07:17:30 +01:00
explore [BUG] Fix tooltip for 1000+ stars/forks 2024-04-10 22:35:21 +00:00
mail Rename Str2html to SanitizeHTML and clarify its behavior (followup) (take 2) 2024-05-13 18:38:48 +00:00
org Show repo count in blocked users tab (#3601) 2024-05-02 17:10:06 +00:00
package templates: Be more forgiving about missing package metadata 2024-05-10 18:10:25 +00:00
projects [PORT] gitea##30237: Fix and rewrite contrast color calculation, fix project-related bugs 2024-05-14 15:50:47 +02:00
repo Merge pull request '[v7.0/forgejo] Expand code diffs against the commits repo' (#3767) from bp-v7.0/forgejo-220c3fe into v7.0/forgejo 2024-05-14 12:42:18 +00:00
shared Make display of EasyMDE in UI optional to template 2024-04-19 13:49:20 +00:00
status Migrate margin and padding helpers to tailwind (#30043) 2024-03-30 07:17:29 +01:00
swagger Catch and handle unallowed file type errors in issue attachment API (#30791) 2024-05-07 08:12:34 +01:00
user Merge pull request 'Port Fix checkbox field markup' (#3592) from 0ko/forgejo:a-commit into v7.0/forgejo 2024-05-02 18:10:20 +00:00
webhook [FEAT] sourcehut webhooks 2024-04-05 19:36:04 +00:00
home.tmpl Migrate margin and padding helpers to tailwind (#30043) 2024-03-30 07:17:29 +01:00
install.tmpl Update checker setting updates 2024-04-10 20:55:35 +00:00
post-install.tmpl [BRANDING] Custom loading animation for Forgejo 2024-02-05 16:02:13 +01:00