fixed --distro and added nicer default colors

This commit is contained in:
echo 2022-11-13 21:17:35 +03:30
parent d6aa2f2679
commit e88edc6c9c
2 changed files with 11 additions and 10 deletions

View file

@ -13,8 +13,8 @@ var usepng bool = false
var hascolor bool = true var hascolor bool = true
var Customascii = false var Customascii = false
var asciidir string var asciidir string
var asciiforced = false var Asciiforced = false
var forceddistro string var Forceddistro string
var Defaultconf bool = false var Defaultconf bool = false
var Defaultcolor bool = false var Defaultcolor bool = false
var colorold bool = false var colorold bool = false
@ -32,8 +32,8 @@ func Initargs() {
asciidir = strings.ReplaceAll(argument[8:], "~", "/home/"+Gethn()) asciidir = strings.ReplaceAll(argument[8:], "~", "/home/"+Gethn())
} }
if strings.HasPrefix(argument, "--distro=") { if strings.HasPrefix(argument, "--distro=") {
asciiforced = true Asciiforced = true
forceddistro = argument[9:] Forceddistro = argument[9:]
} else if strings.HasPrefix(argument, "--") { } else if strings.HasPrefix(argument, "--") {
switch argument { switch argument {
case "--nouwu": case "--nouwu":

View file

@ -37,6 +37,7 @@ var isInProgressLine = false
var logoLines []string var logoLines []string
var logoWidth int var logoWidth int
var defaultcolor = "red 255 38 116 \ngreen 16 210 117\nblue 104 174 212\nwhite 250 253 255"
var pngWidth = 12 var pngWidth = 12
var pngHeight = 12 var pngHeight = 12
var pngData []byte var pngData []byte
@ -53,13 +54,13 @@ func Initcolor() {
} }
if os.IsNotExist(existcolorconf) { if os.IsNotExist(existcolorconf) {
f, _ := os.Create(colorconf) f, _ := os.Create(colorconf)
_, _ = f.WriteString("red 255 0 0 \ngreen 0 255 0\nblue 0 0 255\nwhite 255 255 255") _, _ = f.WriteString(defaultcolor)
} }
c, _ := os.ReadFile(colorconf) c, _ := os.ReadFile(colorconf)
content := string(c) content := string(c)
if Defaultcolor { if Defaultcolor {
content = "red 255 0 0 \ngreen 0 255 0\nblue 0 0 255\nwhite 255 255 255" content = defaultcolor
} }
lines := strings.Split(string(content), "\n") lines := strings.Split(string(content), "\n")
@ -80,8 +81,8 @@ func Initcolor() {
func CutePrintInit() { func CutePrintInit() {
dist := data.GetDistroVariable("ID") dist := data.GetDistroVariable("ID")
logo := asciiarts.GetAscii(dist) logo := asciiarts.GetAscii(dist)
if asciiforced { if Asciiforced {
logo = asciiarts.GetAscii(forceddistro) logo = asciiarts.GetAscii(Forceddistro)
} }
if noascii { if noascii {
logo = "" logo = ""
@ -172,10 +173,10 @@ func parseFormat(format string) (parsedFormat Format) {
} }
func getcustomizeddistro() string { func getcustomizeddistro() string {
if !asciiforced { if !Asciiforced {
return data.GetDistroVariable("ID") return data.GetDistroVariable("ID")
} else { } else {
return forceddistro return Forceddistro
} }
} }