diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2019-10-07 21:15:06 -0400 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2019-10-07 21:15:06 -0400 |
| commit | d0b93f18c92a3b71b091a498acbba2e8419ef94c (patch) | |
| tree | 5b91b2806d034819ba8d3ec7b58de6a04e791b2b /src/theme.py | |
| parent | 523d774550087bacc6250f83421b05fce2ccc3fb (diff) | |
Debug
Diffstat (limited to 'src/theme.py')
| -rw-r--r-- | src/theme.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/theme.py b/src/theme.py index ad59ca4..50a7ee0 100644 --- a/src/theme.py +++ b/src/theme.py @@ -1,6 +1,9 @@ import yaml,re, sys def configure(theme): + """ + Apply user define colors and apply some correction factors. + """ if "colors" in theme: colors=theme["colors"] window_colors=theme["window_colors"] @@ -36,6 +39,9 @@ def configure(theme): return(theme) def validate(theme): + """ + Abort if theme is in a wrong format. + """ abort=lambda msg: sys.exit("Error while loading theme: "+msg) inv_key=lambda key: abort("invalid key \""+key+"\"") for key,value in theme.items(): @@ -51,8 +57,14 @@ def validate(theme): if not(key in ["focused","focused_inactive","unfocused","urgent","child_border"]): inv_key(key) - def load(theme_file): + """ + Load a theme as a dict(): + - Open YAML file + - Parse it as a dict + - Configure the parsed dict + - Validate the configured dict + """ f=open(theme_file,mode="r") theme=yaml.load(f,Loader=yaml.FullLoader) f.close() |
