-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Color scheme for all items in application (#203)
* Color scheme for all items in application * Code cleanup
- Loading branch information
Showing
24 changed files
with
871 additions
and
466 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
default: | ||
text: white, navy | ||
editor: | ||
comment: bold yellow | ||
icomment: bold white | ||
origin: bold lcyan | ||
tearline: bold lcyan | ||
tagline: bold lcyan | ||
kludge: bold gray | ||
dialog: | ||
border: bold white | ||
item: white | ||
selection: bold white, dcyan | ||
title: bold red | ||
messageHeader: | ||
title: bold white, dcyan | ||
border: bold white | ||
header: bold white | ||
item: white | ||
highlight: bold white | ||
selection: default, dcyan | ||
window: default, default | ||
messageList: | ||
border: silver | ||
header: bold green | ||
title: bold white, dcyan | ||
prompt: white | ||
item: silver | ||
highlight: bold lcyan | ||
selection: bold white, dcyan | ||
areaList: | ||
border: silver | ||
header: bold green | ||
title: bold white, dcyan | ||
prompt: white | ||
item: silver | ||
highlight: bold lcyan | ||
selection: bold white, dcyan | ||
areaListModal: | ||
border: silver | ||
header: bold green | ||
title: bold white, dcyan | ||
prompt: white | ||
item: silver | ||
highlight: bold lcyan | ||
selection: bold white, dcyan | ||
statusbar: | ||
text: bold white, navy | ||
help: | ||
border: bold white | ||
title: bold yellow, green | ||
text: default |
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,56 @@ | ||
# | ||
# Default Color Scheme | ||
# Use as reference when building your own one | ||
# | ||
default: | ||
text: silver, black | ||
editor: | ||
comment: bold yellow | ||
icomment: bold white | ||
origin: bold white | ||
tearline: bold white | ||
tagline: bold white | ||
kludge: bold gray | ||
dialog: | ||
border: bold red | ||
item: bold silver | ||
selection: bold silver, navy | ||
title: bold yellow | ||
messageHeader: | ||
title: bold yellow | ||
border: bold blue | ||
header: bold silver | ||
item: silver | ||
highlight: bold silver | ||
selection: silver, navy | ||
window: default, default | ||
messageList: | ||
border: red | ||
header: bold yellow | ||
title: bold yellow | ||
prompt: silver | ||
item: silver | ||
highlight: bold default | ||
selection: bold white, navy | ||
areaList: | ||
border: blue | ||
header: bold yellow | ||
title: bold yellow | ||
prompt: silver | ||
item: silver | ||
highlight: bold silver | ||
selection: white, navy | ||
areaListModal: | ||
border: red | ||
header: bold yellow | ||
title: bold yellow | ||
prompt: silver | ||
item: silver | ||
highlight: bold silver | ||
selection: white, navy | ||
statusbar: | ||
text: bold white, navy | ||
help: | ||
border: bold blue | ||
title: bold yellow | ||
text: default |
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,25 @@ | ||
package config | ||
|
||
import ( | ||
"gopkg.in/yaml.v3" | ||
"io/ioutil" | ||
) | ||
|
||
func readCity() { | ||
yamlFile, err := ioutil.ReadFile("city.yaml") | ||
if err != nil { | ||
return | ||
} | ||
err = yaml.Unmarshal(yamlFile, &city) | ||
if err != nil { | ||
return | ||
} | ||
} | ||
|
||
// GetCity return city | ||
func GetCity(sa string) string { | ||
if val, ok := city[sa]; ok { | ||
return val | ||
} | ||
return "unknown" | ||
} |
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,41 @@ | ||
package config | ||
|
||
import ( | ||
"log" | ||
"regexp" | ||
"strings" | ||
) | ||
|
||
// ParseColorscheme parses the text definition for a colorscheme and returns the corresponding object | ||
// Colorschemes are made up of color-link statements linking a color group to a list of colors | ||
// For example, color-link keyword (blue,red) makes all keywords have a blue foreground and | ||
// red background | ||
// Todo: Implement to read Golded schemes in future | ||
func ParseColorscheme(text string) ColorScheme { | ||
parser := regexp.MustCompile(`color-link\s+(\S*)\s+"(.*)"`) | ||
|
||
lines := strings.Split(text, "\n") | ||
|
||
c := make(ColorScheme) | ||
|
||
for _, line := range lines { | ||
if strings.TrimSpace(line) == "" || | ||
strings.TrimSpace(line)[0] == '#' { | ||
// Ignore this line | ||
continue | ||
} | ||
matches := parser.FindSubmatch([]byte(line)) | ||
if len(matches) == 3 { | ||
link := string(matches[1]) | ||
colors := string(matches[2]) | ||
style, _ := StringToStyle(colors) | ||
c[link] = style | ||
if link == "default" { | ||
style = StyleDefault | ||
} | ||
} else { | ||
log.Println("Color-link statement is not valid:", line) | ||
} | ||
} | ||
return c | ||
} |
Oops, something went wrong.