diff --git a/README.md b/README.md index 6858021..c65109e 100644 --- a/README.md +++ b/README.md @@ -1 +1,6 @@ -in beta or something idk \ No newline at end of file +
imagine neofetch, but OwO +
\ No newline at end of file diff --git a/arch.png b/arch.png deleted file mode 100644 index 12c71b5..0000000 Binary files a/arch.png and /dev/null differ diff --git a/go.mod b/go.mod index 4bfef1d..607ea8e 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,3 @@ module github.com/exhq/neowofetch -go 1.19 - -require ( - github.com/fatih/color v1.13.0 - github.com/mattn/go-colorable v0.1.9 // indirect - github.com/mattn/go-isatty v0.0.14 // indirect - golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect -) +go 1.19 \ No newline at end of file diff --git a/go.sum b/go.sum index 6ab7ee4..e69de29 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +0,0 @@ -github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c h1:F1jZWGFhYfh0Ci55sIpILtKKK8p3i2/krTr0H1rg74I= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/main.go b/main.go index b3ff92d..434c614 100644 --- a/main.go +++ b/main.go @@ -213,6 +213,7 @@ func getColorPalette() { func main() { utils.Initargs() + utils.Initcolor() utils.CutePrintInit() handleConfig() utils.CutePrintEnd() diff --git a/utils/args.go b/utils/args.go index 7755377..1508e88 100644 --- a/utils/args.go +++ b/utils/args.go @@ -9,6 +9,7 @@ var args []string var shoulduwuify bool = true var noascii bool = false var usepng bool = false +var hascolor bool = true func Initargs() { args = os.Args[1:] @@ -21,6 +22,8 @@ func Initargs() { noascii = true case "--usepng": usepng = true + case "--nocolor": + hascolor = false } } } diff --git a/utils/printing.go b/utils/printing.go index 8b68a73..ee9d496 100644 --- a/utils/printing.go +++ b/utils/printing.go @@ -3,8 +3,9 @@ package utils import ( "encoding/base64" "fmt" - "math/rand" "os" + "path/filepath" + "strconv" "strings" "github.com/exhq/neowofetch/data" @@ -15,29 +16,8 @@ func rgb(r, g, b int) string { return fmt.Sprintf("\x1b[38:2::%d:%d:%dm", r, g, b) } -var colors = map[string]string{ - "green": rgb(0, 255, 0), - "blue": rgb(0, 0, 255), - "red": rgb(255, 0, 0), -} +var colors = make(map[string]string) -var uwuEmotes = [15]string{ - "owo", - "UwU", - ">w<", - "^w^", - "âwâ", - "âwâ", - "đ¨đđ¨", - "(´ęł`)", - "âĽ(ăU Ď Uă)", - "(ËÎľË)", - "( Ëá´Ë )", - "(*ภĚËภĚ*)", - "*screams*", - "*twerks*", - "*sweats*", -} var logoIndex = 0 var isInProgressLine = false var logoLines []string @@ -47,6 +27,34 @@ var pngWidth = 12 var pngHeight = 12 var pngData []byte +func Initcolor() { + colorconf := os.Getenv("HOME") + "/.config/neowofetch/colors" + folderconf := filepath.Dir(colorconf) + + _, existcolorconf := os.Stat(colorconf) + _, existfolderconf := os.Stat(folderconf) + + if os.IsNotExist(existfolderconf) { + os.Mkdir(folderconf, os.ModePerm) + } + if os.IsNotExist(existcolorconf) { + println("color was not found. a default config file has been generated in '~/.config/neowofetch/colors'. rerun the program") + f, _ := os.Create(colorconf) + _, _ = f.WriteString("red 255 0 0 \nblue 0 255 0\nred 0 0 255\nwhite 255 255 255") + os.Exit(0) + } + + content, _ := os.ReadFile(colorconf) + lines := strings.Split(string(content), "\n") + for _, line := range lines { + word := strings.Split(line, " ") + R, _ := strconv.Atoi(word[1]) + G, _ := strconv.Atoi(word[2]) + B, _ := strconv.Atoi(word[3]) + colors[word[0]] = rgb(R, G, B) + } +} + func CutePrintInit() { dist := data.GetDistroVariable("ID") logo := Getascii(dist) @@ -55,7 +63,7 @@ func CutePrintInit() { } if usepng { pngData = images.DistroImages[dist] - logo = strings.Repeat(" ", pngWidth) + strings.Repeat("\n", pngHeight) + logo = strings.Repeat(" ", pngWidth) + " " + strings.Repeat("\n", pngHeight) } logoLines = strings.Split(logo, "\n") logoWidth = 0 @@ -111,7 +119,7 @@ type Format struct { func parseFormat(format string) (parsedFormat Format) { for _, v := range strings.Split(format, "|") { colorFormat, isColor := colors[v] - if isColor { + if isColor && hascolor { parsedFormat.colorFormat += colorFormat } else { switch v { @@ -123,7 +131,9 @@ func parseFormat(format string) (parsedFormat Format) { parsedFormat.noUwuOverride = true case "*": default: - //println("Unknown format code: ", v) + if hascolor { + println("Unknown format code: ", v) + } } } } @@ -145,9 +155,6 @@ func CutePrint( func CuteNewLine() { printLogoIfAtBeginningOfNewLine() - if rand.Intn(5) == 0 && shoulduwuify { - fmt.Printf(" %s", uwuEmotes[rand.Intn(len(uwuEmotes))]) - } isInProgressLine = false fmt.Println() }