From 3ad89d9db46e3a6c8d1ad3f51d706915be475b89 Mon Sep 17 00:00:00 2001 From: Boris Faure Date: Sun, 22 Nov 2020 21:58:21 +0100 Subject: [PATCH] colorschemes: simplify procedure --- COLORSCHEMES.md | 8 ++++---- data/colorschemes/gen_faint.py | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/COLORSCHEMES.md b/COLORSCHEMES.md index 84844bdf..1f629662 100644 --- a/COLORSCHEMES.md +++ b/COLORSCHEMES.md @@ -94,17 +94,17 @@ are creating the color scheme `FooBar` stored in file `FooBar.ini`. The `Faint` and `BrightFaint` version can be generated by using the `gen_faint.py` script stored in `data/color_schemes/` as seen below: -`gen_faint.py FooBar.ini > FooBar_with_faint.ini` +`gen_faint.py FooBar.ini` What this script does is to pick the colors from `Normal` and `Bright` and merge them with the background color (`Colors.bg`) in a 70/30 proportion. This proportion is configurable, like this for a 80/20 proportion: -`gen_faint.py FooBar.ini 80 > FooBar_with_faint.ini` +`gen_faint.py FooBar.ini 80` -Now that we are happy with the content of `FooBar_with_faint.ini`, we can call +Now that we are happy with the content of `FooBar.ini`, we can call the script `add_color_scheme.sh` stored in `data/color_schemes/` as seen below: -`add_color_scheme.sh eet ~/.config/terminology/colorschemes.eet FooBar_with_faint.ini` +`add_color_scheme.sh eet ~/.config/terminology/colorschemes.eet FooBar.ini` Now you should be able to select your color scheme in Terminology! diff --git a/data/colorschemes/gen_faint.py b/data/colorschemes/gen_faint.py index 7acd2def..37a4b353 100755 --- a/data/colorschemes/gen_faint.py +++ b/data/colorschemes/gen_faint.py @@ -24,8 +24,8 @@ def blend_color(cfg, blend_factor, src, dest, color_name): def main(): parser = argparse.ArgumentParser(description='Generate Faint colors in INI colorschemes description files.') - parser.add_argument('input_file', - type=argparse.FileType('r'), + parser.add_argument('file', + type=argparse.FileType('r+'), help='INI File to convert') parser.add_argument('blend_factor', type=int, nargs='?', default=75, @@ -33,7 +33,7 @@ def main(): args = parser.parse_args() cfg = configparser.ConfigParser() - cfg.read_file(args.input_file) + cfg.read_file(args.file) f = args.blend_factor @@ -69,7 +69,8 @@ def main(): blend_color(cfg, f, 'Bright', 'BrightFaint', 'inverse_fg') blend_color(cfg, f, 'Bright', 'BrightFaint', 'inverse_bg') - cfg.write(sys.stdout) + args.file.truncate(size=0) + cfg.write(args.file) if __name__ == "__main__":