From 5a0bb0a4a88b549dfa8130270ffd83c134deabb6 Mon Sep 17 00:00:00 2001 From: Anton Novojilov Date: Tue, 24 Aug 2021 20:17:25 +0300 Subject: [PATCH] Refactoring --- .gitignore | 1 + badge.go | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f95d7e7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +Veradana.ttf diff --git a/badge.go b/badge.go index 3b353aa..5cd8e49 100644 --- a/badge.go +++ b/badge.go @@ -245,13 +245,13 @@ func getMessageColors(badgeColor string) (string, string) { } // parseColor parses hex color -func parseColor(c string) int { - i, _ := strconv.ParseInt(c, 16, 64) - return int(i) +func parseColor(c string) int64 { + i, _ := strconv.ParseInt(c, 16, 32) + return i } // calcLuminance calculates relative luminance -func calcLuminance(color int) float64 { +func calcLuminance(color int64) float64 { r := calcLumColor(float64(color>>16&0xFF) / 255) g := calcLumColor(float64(color>>8&0xFF) / 255) b := calcLumColor(float64(color&0xFF) / 255)