mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-01-23 06:18:35 +01:00
Beautify
This commit is contained in:
parent
c0896043aa
commit
c29151de46
@ -21,4 +21,4 @@ The goal of Pywal was to be as out of the way as possible. It doesn't modify any
|
|||||||
|
|
||||||
Terminal emulators and TTYs have their color-schemes updated in real-time with no delay. With minimal configuration this functionality can be extended to almost anything running on your system.
|
Terminal emulators and TTYs have their color-schemes updated in real-time with no delay. With minimal configuration this functionality can be extended to almost anything running on your system.
|
||||||
|
|
||||||
### More: \[[Installation](https://github.com/dylanaraps/pywal/wiki/Installation)\] \[[Getting Started](https://github.com/dylanaraps/pywal/wiki/Getting-Started)\] \[[Customization](https://github.com/dylanaraps/pywal/wiki/Customization)\] \[[Wiki](https://github.com/dylanaraps/pywal/wiki)\] \[[Screenshots](https://www.reddit.com/r/unixporn/search?q=wal&restrict_sr=on&sort=relevance&t=all)\]
|
### More: \[[Installation](https://github.com/dylanaraps/pywal/wiki/Installation)] \[[Getting Started](https://github.com/dylanaraps/pywal/wiki/Getting-Started)] \[[Customization](https://github.com/dylanaraps/pywal/wiki/Customization)] \[[Wiki](https://github.com/dylanaraps/pywal/wiki)] \[[Screenshots](https://www.reddit.com/r/unixporn/search?q=wal&restrict_sr=on&sort=relevance&t=all)]
|
||||||
|
@ -27,19 +27,25 @@ def template(colors, input_file, output_file=None):
|
|||||||
new_color = colors[color]
|
new_color = colors[color]
|
||||||
# Execute each function to be done
|
# Execute each function to be done
|
||||||
for func in filter(None, funcs.split(")")):
|
for func in filter(None, funcs.split(")")):
|
||||||
### Get function name and arguments
|
# Get function name and arguments
|
||||||
func_split = func.split("(")
|
func_split = func.split("(")
|
||||||
args = []
|
args = []
|
||||||
if len(func_split) > 1: args = func_split[1].split(",")
|
if len(func_split) > 1:
|
||||||
|
args = func_split[1].split(",")
|
||||||
fname = func_split[0]
|
fname = func_split[0]
|
||||||
if fname[0] == '.': fname = fname[1:]
|
if fname[0] == '.':
|
||||||
|
fname = fname[1:]
|
||||||
|
if not hasattr(new_color, fname):
|
||||||
|
logging.error(
|
||||||
|
"Syntax error in template file '%s' on line '%s'", input_file, i)
|
||||||
f = getattr(new_color, fname)
|
f = getattr(new_color, fname)
|
||||||
|
|
||||||
# If the function is callable, call it
|
# If the function is callable, call it
|
||||||
if callable(f):
|
if callable(f):
|
||||||
new_color = f(*args)
|
new_color = f(*args)
|
||||||
# add to the string that will replace the function calls with the generated function.
|
# add to the string that will replace the function calls with the generated function.
|
||||||
if func[0] != '.': replace_str += "."
|
if func[0] != '.':
|
||||||
|
replace_str += "."
|
||||||
replace_str += func + ")"
|
replace_str += func + ")"
|
||||||
# If the color was changed, replace the template with a unique identifier for the new color.
|
# If the color was changed, replace the template with a unique identifier for the new color.
|
||||||
if not new_color is colors[color]:
|
if not new_color is colors[color]:
|
||||||
|
@ -1 +0,0 @@
|
|||||||
{color0.lighten(10).darken(10).rgb}
|
|
@ -76,6 +76,7 @@ def read_file(input_file):
|
|||||||
with open(input_file, "r") as file:
|
with open(input_file, "r") as file:
|
||||||
return file.read().splitlines()
|
return file.read().splitlines()
|
||||||
|
|
||||||
|
|
||||||
def read_file_json(input_file):
|
def read_file_json(input_file):
|
||||||
"""Read data from a json file."""
|
"""Read data from a json file."""
|
||||||
with open(input_file, "r") as json_file:
|
with open(input_file, "r") as json_file:
|
||||||
|
Loading…
Reference in New Issue
Block a user