25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/na/theme.rb', line 25
def load_theme(template: {})
default_template = {
parent: '{c}',
bracket: '{dc}',
parent_divider: '{xw}/',
action: '{bg}',
project: '{xbk}',
tags: '{m}',
value_parens: '{m}',
values: '{c}',
search_highlight: '{y}',
note: '{dw}',
dirname: '{xdw}',
filename: '{xb}{#eccc87}',
prompt: '{m}',
success: '{bg}',
error: '{b}{#b61d2a}',
warning: '{by}',
debug: '{dw}',
templates: {
output: '%filename%parents| %action',
default: '%parent%action',
single_file: '%parent%action',
multi_file: '%filename%parent%action',
no_file: '%parent%action'
}
}
theme_file = NA.database_path(file: 'theme.yaml')
theme = if File.exist?(theme_file)
YAML.load(IO.read(theme_file)) || {}
else
{}
end
theme = default_template.deep_merge(theme)
File.open(theme_file, 'w') do |f|
f.puts template_help.
f.puts YAML.dump(theme)
end
theme.merge(template)
end
|