colorschemes: simplify procedure

This commit is contained in:
Boris Faure 2020-11-22 21:58:21 +01:00
parent ff93e0a8a2
commit 3ad89d9db4
Signed by: borisfaure
GPG Key ID: 35C0410516166BE8
2 changed files with 9 additions and 8 deletions

View File

@ -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!

View File

@ -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__":