blob: d7926f833a4a78a3f23c64a7e50abb5b9bb6edcb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
--- a/colornameconv.go
+++ b/colornameconv.go
@@ -5,11 +5,7 @@
"errors"
"fmt"
"github.com/crazy3lf/colorconv"
- "io"
"math"
- "os"
- "path"
- "runtime"
"strings"
)
@@ -74,21 +70,9 @@
}
func readJson() Colors {
- _, filename, _, ok := runtime.Caller(0)
- if !ok {
- panic("No caller information")
- }
- in, err := os.Open(path.Dir(filename) + "/colors.json")
-
- if err != nil {
- panic(fmt.Sprintf("Failed to read JSON file: %s", err))
- }
-
- byteValue, _ := io.ReadAll(in)
-
var colors Colors
- err = json.Unmarshal(byteValue, &colors)
+ err := json.Unmarshal(colorsJSON, &colors)
if err != nil {
panic(fmt.Sprintf("Failed to unmarshal JSON: %s", err))
|