-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Please label this issue as fit. Intentionally avoided any terminology around base16, as I'm still very confused about it.
This is yet another idea brought from base9.
We should use nested variable names (i.e. part1.part2) instead of - separated.
This has two aspects to it. The second builds on top of the first one, but both can be considered independently.
formatting
Use base03.hex instead of base03-hex
Advantage:
Instead of
<string>{{base07-dec-r}} {{base07-dec-g}} {{base07-dec-b}} 1</string>we can write
{{#base07}}<string>{{dec-r}} {{dec-g}} {{dec-b}} 1</string>{{/base07}}Which is much easier for template maintainer.
For more complicated templates, we could potentially use mustache partials
{{#base07}}{{>partial}}{{/base07}}semantic aliasing
when defining semantic aliasing
instead of
button.foreground: "#{{button_foreground.hex}}"
button.background: "#{{button_background.hex}}"
terminal.red: "#{{ansi_red.hex}}"
terminal.green: "#{{ansi_green.hex}}"we can say
{{#button}}
button.foreground: "#{{foreground.hex}}"
button.background: "#{{background.hex}}"
{{/button}}
{{#ansi}}
terminal.red: "#{{red.hex}}"
terminal.green: "#{{green.hex}}"
{{/ansi}}For semantic alias override:
instead of
button_background: base09
button_foreground: base00we can say
primary_normal:
bg: base00
fg: base09
primary_inverted:
bg: base09
fg: base00
primary_button: primary_invertedor
button:
bg: base09
fg: base00You get the idea. Which style/syntax/alias we support in the spec can be debated more in detail in follow up discussion, but I just want to introduce this idea first discuss why nested scopes are good.
Advantage:
- easier to read the spec/aliases
- easier for scheme developer to override the default if we decide to support something like in the
primary_invertedexample. - we can group domain specific semantics together for easier template development. (i.e.
ansi,markdown)
All these are already implemented in base9, and in my experience, it works pretty well.
base9 alias config: https://github.com/base9-theme/base9-builder/blob/main/src/default_config.yml#L19
base9 template that uses nested variables heavily: https://github.com/base9-theme/base9-builder/blob/main/templates/preview.mustache