-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hints kitten: Workaround for some broken light color themes that make…
… the hints text color too low contrast to read Fixes #7330
- Loading branch information
1 parent
182bd9c
commit 8931062
Showing
5 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package utils | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
var _ = fmt.Print | ||
|
||
func RGBLuminance(r, g, b float32) float32 { | ||
// From ITU BT 601 https://www.itu.int/rec/R-REC-BT.601 | ||
return 0.299*r + 0.587*g + 0.114*b | ||
} | ||
|
||
func RGBContrast(r1, g1, b1, r2, g2, b2 float32) float32 { | ||
al := RGBLuminance(r1, g1, b1) | ||
bl := RGBLuminance(r2, g2, b2) | ||
if al < bl { | ||
al, bl = bl, al | ||
} | ||
return (al + 0.05) / (bl + 0.05) | ||
} |