-
-
Notifications
You must be signed in to change notification settings - Fork 813
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WTF-730 Fix missing color key config error
Signed-off-by: Chris Cummer <[email protected]>
- Loading branch information
1 parent
1bfca29
commit 7dd1654
Showing
10 changed files
with
200 additions
and
61 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,23 @@ | ||
wtf: | ||
refreshInterval: 1 | ||
openFileUtil: "open" | ||
mods: | ||
battery: | ||
type: power | ||
title: "⚡️" | ||
enabled: true | ||
position: | ||
top: 0 | ||
left: 0 | ||
height: 1 | ||
width: 1 | ||
refreshInterval: 15 | ||
security_info: | ||
type: security | ||
enabled: true | ||
position: | ||
top: 0 | ||
left: 1 | ||
height: 1 | ||
width: 1 | ||
refreshInterval: 3600 |
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,106 @@ | ||
package cfg | ||
|
||
import ( | ||
"github.com/olebedev/config" | ||
"gopkg.in/yaml.v2" | ||
) | ||
|
||
// BorderTheme defines the default color scheme for drawing widget borders | ||
type BorderTheme struct { | ||
Focusable string | ||
Focused string | ||
Unfocusable string | ||
} | ||
|
||
// CheckboxTheme defines the default color scheme for drawing checkable rows in widgets | ||
type CheckboxTheme struct { | ||
Checked string | ||
} | ||
|
||
// RowTheme defines the default color scheme for row text | ||
type RowTheme struct { | ||
EvenBackground string | ||
EvenForeground string | ||
|
||
OddBackground string | ||
OddForeground string | ||
|
||
HighlightedBackground string | ||
HighlightedForeground string | ||
} | ||
|
||
// TextTheme defines the default color scheme for text rendering | ||
type TextTheme struct { | ||
Subheading string | ||
Text string | ||
Title string | ||
} | ||
|
||
type WidgetTheme struct { | ||
Background string | ||
} | ||
|
||
// ColorTheme is an alamgam of all the default color settings | ||
type ColorTheme struct { | ||
BorderTheme | ||
CheckboxTheme | ||
RowTheme | ||
TextTheme | ||
WidgetTheme | ||
} | ||
|
||
// NewDefaultColorTheme creates and returns an instance of DefaultColorTheme | ||
func NewDefaultColorTheme() ColorTheme { | ||
defaultTheme := ColorTheme{ | ||
BorderTheme: BorderTheme{ | ||
Focusable: "blue", | ||
Focused: "orange", | ||
Unfocusable: "gray", | ||
}, | ||
|
||
CheckboxTheme: CheckboxTheme{ | ||
Checked: "white", | ||
}, | ||
|
||
RowTheme: RowTheme{ | ||
EvenBackground: "transparent", | ||
EvenForeground: "white", | ||
|
||
OddBackground: "transparent", | ||
OddForeground: "lightblue", | ||
|
||
HighlightedForeground: "black", | ||
HighlightedBackground: "green", | ||
}, | ||
|
||
TextTheme: TextTheme{ | ||
Subheading: "red", | ||
Text: "white", | ||
Title: "green", | ||
}, | ||
|
||
WidgetTheme: WidgetTheme{ | ||
Background: "transparent", | ||
}, | ||
} | ||
|
||
return defaultTheme | ||
} | ||
|
||
// NewDefaultColorConfig creates and returns a config.Config-compatible configuration struct | ||
// using a DefaultColorTheme to pre-populate all the relevant values | ||
func NewDefaultColorConfig() (*config.Config, error) { | ||
colorTheme := NewDefaultColorTheme() | ||
|
||
yamlBytes, err := yaml.Marshal(colorTheme) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
cfg, err := config.ParseYamlBytes(yamlBytes) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return cfg, nil | ||
} |
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
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
Oops, something went wrong.