billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=3ad89d9db46e3a6c8d1ad3f51d706915be475b89

commit 3ad89d9db46e3a6c8d1ad3f51d706915be475b89
Author: Boris Faure <bill...@gmail.com>
Date:   Sun Nov 22 21:58:21 2020 +0100

    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 84844bd..1f62966 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 7acd2de..37a4b35 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__":

-- 


Reply via email to