-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: flavor
iteration, rework --overrides
& add examples
#111
Conversation
From further discussion on discord with @nullishamy, I've also found that using This isn't great for us because I'd imagine we always, if not most of the time, want to control the ordering of how the flavours and colours are listed. With the hashmap implementation, I'm always getting Frappe at the start instead of Latte on READMEs. Potential solutions might be to use Vecs and/or ordered Hashmaps? GoalThe following handlebars syntax: {{#each flavors}}
- **{{flavor}}**
{{ #each colors as | color colorName | }}
- **{{colorName}}**
{{/each}}
{{/each}} should produce the same order of flavours & colours as the main catppuccin/catppuccin table |
Yeah, I noticed that the order wasn't guaranteed, #104 was pretty rushed to just add the basic functionality without spending much time doing Rust. As for the frontmatter, it would probably make sense if we enforced explicit color overrides, like in VSCode/nvim etc, e.g. colorOverrides:
mocha: {}
macchiato: {}
frappe: {}
latte: {}
all: {} The other frontmatter can probably be safely assumed to be global, since |
@nekowinston I did have a look at When you say explicit color overrides, do you mean removing them as a command line flag and making them only available in the frontmatter? Also what I meant in my initial comment is that I'd still like to alias colours to variable names so that it can act like documentation. E.g. With the new changes, I can configure the Slack port as follows:
But I'd prefer an approach similar to how the slack port currently looks where the variable names are mapped to the colours in the frontmatter:
The approach I've defined is impossible, at the minute, as the frontmatter is rendered before the template itself. Of course, when you set it the I suppose what I'd be interested is maybe a helper of some sort to allow this mapping/aliasing of a variable name to a colour? |
I wrote that comment before I saw your indexmap commit, consider that resolved 🙃
Yeah, since you can still set them via JSON in
That makes sense, terminal ports are a good use case here as well; they can share a common frontmatter like bg: {{ base }}
fg: {{ text }}
sel: {{ surface2 }}
color0: {{ darklight subtext0 surface1 }}
color1: {{ red }}
color2: {{ green }}
color3: {{ yellow }}
color4: {{ blue }}
color5: {{ pink }}
color6: {{ sky }}
color7: {{ darklight subtext1 surface2 }}
color8: {{ darklight surface2 subtext0 }}
color9: {{ red }}
color10: {{ green }}
color11: {{ yellow }}
color12: {{ blue }}
color13: {{ pink }}
color14: {{ sky }}
color15: {{ darklight surface1 subtext1 }} That would require dealing with the current flavor context as well, though. |
@nullishamy and I were discussing overrides earlier and we failed to see how the overrides object could be defined in the frontmatter for single flavours. i.e. Given this command here in lazygit: @{{whiskers_cmd}} {{template_path}} {{flavor}} --override accent="{{accent}}" > {{output_base}}/{{flavor}}/{{accent}}.yml The I did mention that it feels a bit odd to rely on the overrides flag to generate files with different accents. There's something in me that feels odd about it but maybe that's just me. |
bd0c2b9
to
9759473
Compare
The latest commit that I've just pushed ( However, there's still some things to hash out / do:
|
Yeah
in vscode, the overrides are applied like this: Taking the library palette, combining it with {
"colorOverrides": {
"all": {
"base": "#000000"
},
"latte": {
"base": "#ffffff"
}
}
} would result in Mocha, Macchiato, Frappe having a black background while Latte keeps white.
This should work regardless of how the template is built, single flavor per file, multiple flavors per file. |
I'm still unsure on how overrides for single flavours could be defined in the yaml as specified in #111 (comment) @nekowinston The lazygit port essentially relies on a placeholder variable to be overridden on every single invocation for all the accents, having it defined in the yaml doesn't make sense for how that is currently implemented. |
Iterating over accents like that almost feels like it should be handled by more of a build system/task runner (which it technically is with the |
---
accent: "{{ blue }}"
---
theme:
activeBorderColor:
- '#{{ accent }}' "{{ blue }}" is defining the default here; |
I do agree tho that I'd prefer if we didn't have to write absolutely cursed build files, this justfile seems like a step down from saner build scripts. I'd like it if whiskers could handle the "build" similar to how other build systems deal with |
Agreed, although I think we're doing a good job of trying to integrate it in a variety of different settings and seeing the pain points so we can iteratively improve the design. #112 should really help with this. |
I think you can actually omit I'm going to try and get the following syntax parsed for the single file support: ---
# Set default accent color
accent: "{{mauve}}"
# Set custom variables
user: "@sgoudham"
overrides:
# And you can override variables for specific flavors
frappe:
name: "frappé"
accent: "{{blue}}"
mocha:
accent: "{{green}}"
user: "@nekowinston"
--- Unfortunately it's going to probably going to take some trial and error for me to get it right lol I think it's honestly better ignoring the differences between "root" and "flavour" contexts when it's in the single file because it's such a headache to keep track of. Even if that means that a variable defined at the root level is duplicated into each of the flavours when it's not necessarily going to be used at the flavour level (this model is much better for updating the context when passing overrides anyways) |
No my point is that |
I suppose the con is that you might potentially have to write out a long JSON string when calling whiskers, but somewhat mitigated by common tools like |
I suppose I'm just confused at a potential situation in the frontmatter like below: ---
# Set default accent color
accent: "{{mauve}}"
# Set custom variables
user: "@sgoudham"
overrides:
all:
accent: "?"
# And you can override variables for specific flavors
frappe:
name: "frappé"
accent: "{{blue}}"
mocha:
accent: "{{green}}"
user: "@nekowinston"
--- You wouldn't define the |
At that point you're probably customizing a theme rather than authoring it, I'd hope; otherwise our build tool is pretty bad 🙃 That's why I said
I'd love if we could also get generating multiple accents working later, with standardized, generated filenames.
Sure; like with your slack color example that just needs to stay the same across all flavors for some reason. |
You? The most nix-pilled user on GitHub? Thinking of nix? I am shaken to my very core Yeah I think a lot of my confusion came from the fact that we're wanting to keep the frontmatter the same even though the overrides yaml block would only be valid in single file mode vs the other modes. I'll have a go at reworking all the overrides stuff to take in a JSON string and merging that with the existing frontmatter since it's only taking in key/value pairs atm. |
Just have been writing documentation and I've only now just realised that we don't actually need the Will aim to push everything up soon you can understand it via the README 👍 |
flavor
iteration with new option all
flavor
iteration, support --overrides
, add examples & update docs
As discussed on discord with @nekowinston, the current overrides are always in the context of the current flavour, and this may not be the exact behaviour that we want. However, this PR puts us in a better place than we were before so should be good to get reviewed and merged now 👍 (might be good to tag and release as a v2 alpha?) Half of the files modified are new examples so it's best to just ignore that directory in the file view and jump to reviewing the |
1e6c581
to
703285b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Would have some notes about style/architecture but given that this is still very early stages, I think we can leave it for future refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR has marinated long enough, will merge and we can continue to iterate on it.
flavor
iteration, support --overrides
, add examples & update docsflavor
iteration, rework --overrides
& add examples
Still some outstanding questions / design decisions to hash out.
I've added a new
nested.hbs
file that does currently render, but I'm not quite sure how frontmatter should be handled when passing in the case of theall
argument. I don't think we want to treat the entire file as being under the{{#each}}
nested object but maybe we do?BEGIN_COMMIT_OVERRIDE
chore(whiskers): experiment with overrides & flavour iteration
END_COMMIT_OVERRIDE