diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-05-20 13:21:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-20 05:21:01 +0000 |
commit | b6574099edbb47e119762700f637c8da349cca2b (patch) | |
tree | 5ebb506c98b26d406b600f0e9d881b8bfa37914c /modules | |
parent | 47accfebbd69e5f47d1b97a3e39cf181fab7e597 (diff) | |
download | gitea-b6574099edbb47e119762700f637c8da349cca2b.tar.gz gitea-b6574099edbb47e119762700f637c8da349cca2b.zip |
Fix project column title overflow (#31011)
By the way:
* Re-format the "color.go" to Golang code style
* Remove unused `overflow-y: scroll;` from `.project-column` because
there is `overflow: visible`
Diffstat (limited to 'modules')
-rw-r--r-- | modules/util/color.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/util/color.go b/modules/util/color.go index 9c520dce78..8fffc91ac4 100644 --- a/modules/util/color.go +++ b/modules/util/color.go @@ -1,5 +1,6 @@ // Copyright 2023 The Gitea Authors. All rights reserved. // SPDX-License-Identifier: MIT + package util import ( @@ -8,7 +9,7 @@ import ( "strings" ) -// Get color as RGB values in 0..255 range from the hex color string (with or without #) +// HexToRBGColor parses color as RGB values in 0..255 range from the hex color string (with or without #) func HexToRBGColor(colorString string) (float64, float64, float64) { hexString := colorString if strings.HasPrefix(colorString, "#") { @@ -35,7 +36,7 @@ func HexToRBGColor(colorString string) (float64, float64, float64) { return r, g, b } -// Returns relative luminance for a SRGB color - https://en.wikipedia.org/wiki/Relative_luminance +// GetRelativeLuminance returns relative luminance for a SRGB color - https://en.wikipedia.org/wiki/Relative_luminance // Keep this in sync with web_src/js/utils/color.js func GetRelativeLuminance(color string) float64 { r, g, b := HexToRBGColor(color) @@ -46,8 +47,8 @@ func UseLightText(backgroundColor string) bool { return GetRelativeLuminance(backgroundColor) < 0.453 } -// Given a background color, returns a black or white foreground color that the highest -// contrast ratio. In the future, the APCA contrast function, or CSS `contrast-color` will be better. +// ContrastColor returns a black or white foreground color that the highest contrast ratio. +// In the future, the APCA contrast function, or CSS `contrast-color` will be better. // https://github.com/color-js/color.js/blob/eb7b53f7a13bb716ec8b28c7a56f052cd599acd9/src/contrast/APCA.js#L42 func ContrastColor(backgroundColor string) string { if UseLightText(backgroundColor) { |