From ea7954f069bf8bcb87d520f8aab0a80b0768590d Mon Sep 17 00:00:00 2001 From: Hester Gong Date: Wed, 10 May 2023 19:19:03 +0800 Subject: Modify luminance calculation and extract related functions into single files (#24586) Close #24508 Main changes: As discussed in the issue 1. Change luminance calculation function to use [Relative Luminance](https://www.w3.org/WAI/GL/wiki/Relative_luminance) 2. Move the luminance related functions into color.go/color.js 3. Add tests for both the files (Not sure if test cases are too many now) Before (tests included by `UseLightTextOnBackground` are labels started with `##`): https://try.gitea.io/HesterG/testrepo/labels After: Screen Shot 2023-05-08 at 13 37 55 Screen Shot 2023-05-08 at 13 38 06 Screen Shot 2023-05-08 at 13 38 20 --------- Co-authored-by: silverwind Co-authored-by: Giteabot --- web_src/js/components/ContextPopup.vue | 5 ++-- web_src/js/features/repo-projects.js | 5 ++-- web_src/js/utils.js | 14 ------------ web_src/js/utils/color.js | 42 ++++++++++++++++++++++++++++++++++ web_src/js/utils/color.test.js | 34 +++++++++++++++++++++++++++ 5 files changed, 82 insertions(+), 18 deletions(-) create mode 100644 web_src/js/utils/color.js create mode 100644 web_src/js/utils/color.test.js (limited to 'web_src') diff --git a/web_src/js/components/ContextPopup.vue b/web_src/js/components/ContextPopup.vue index 98f9db51f9..bef9b7a6f3 100644 --- a/web_src/js/components/ContextPopup.vue +++ b/web_src/js/components/ContextPopup.vue @@ -26,7 +26,7 @@