-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat(console): support dynamic style injections #703
feat(console): support dynamic style injections #703
Conversation
I think it's a good feature, but I always disliked Symfony's style tags (these look very similar). Couldn't we do something like
Or something like
IDK about the syntax, but I'd like to brainstorm some more about it first. |
Fair enough, here are my thoughts:
Out of those three, I don't have a strong opinion, I like both the @aidan-casey any opinion here? |
I can think of two more syntaxes:
We can use something else than |
There might be something to this. I do think with need something else than the
But writing it like this reminds me that it's essentially the same thing Symfony does… <info>Tempest</> I was reminded of how tempest/highlight works: {:bg-dark-red:fg-white:underline:Tempest:} But that's more difficult to parse again, and not really readable… That makes me circle back to what you originally implemented, or maybe the |
Let's go with the style tag then 👍 |
Pull Request Test Coverage Report for Build 11799352273Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
Cool! Is this ready for a final review then? |
@brendt yes it is! |
This is so great, I've got nothing to add! Oh maybe one more thing after merging: did you intend to write docs for this, or do you want me to tackle that? |
To be honest I initially thought of this as a kind of internal feature, but now that I think more about it, you're right—it could totally be documented If you want to tackle it, feel free, otherwise I'll do it with my console components PR :) |
I've made an issue for it, we'll see who gets to it first |
This pull request adds support for dynamic style injections, responding to the need to write arbitrary styles.
For context, I have this need in my upcoming "prompts" pull request—I am currently adding injections as I see the need for them, but I need too many colors (eg.
danger
,warning
,hint
,dim
...) which don't really fit the semantic injection paradigm we have now.Essentially, the following is now possible:
Before edit
This works by adding a new
DynamicInjection
injection, which will parse the tag and styles and will look for a corresponding values in theTerminalStyle
enum fromtempest/highlight
.See also: tempestphp/highlight#162