Skip to content
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

Add a new inherit color option #994

Closed
1 task done
TheOnlyTails opened this issue Sep 24, 2021 · 16 comments · Fixed by #993
Closed
1 task done

Add a new inherit color option #994

TheOnlyTails opened this issue Sep 24, 2021 · 16 comments · Fixed by #993
Assignees
Labels
🚀 feat New feature

Comments

@TheOnlyTails
Copy link

Code of Conduct

  • I agree to follow this project's Code of Conduct

What would you like to see changed/added?

A new color value called inherit, which would automatically use the color of the previous segment.
If the segment in which inherit is used has nothing to inherit from (whether by being the first segment, or inheritColor is false for the block), the default color will be used (as if the field is not specified) and a warning will be issued.

I would also be nice to have an inheritColor option on blocks, which would specify if segments in said block are allowed to inherit the color from segments in other blocks.

for example, if we have this block:

{
	// -- snip --
	"segments": [
		{
			"type": "session",
			"style": "diamond",
			"foreground": "#ffffff",
			"background": "inherit", // warning
			"leading_diamond": "\uE0B6"
		},
		{
			"type": "path",
			"style": "plain",
			"foreground": "inherit", // will have the same foreground color as the session segment
            "background": "inherit", // will have the same background color as the session segment
            "properties": {
                "style": "folder"
            }
		}
	]
}
@TheOnlyTails
Copy link
Author

I'm also thinking of a new type segment called inherit that works like so:

  • has only the shared prefix and postfix properties
  • can't have text apart from said properties
  • automatically inherits the foreground and background colors

It would allow for very easy rounding segments:

{
	"type": "inherit",
	"properties": {
		"prefix": "\uE0B6"
	}
}

We could even have new round_start and round_end fields on segments which would automatically add those characters to the start and end of segments to make them round, but that's probably fit for another issue.

@JanDeDobbeleer
Copy link
Owner

I don't immediately see the use case for the first suggestion as this change already convers that which in combination with a diamond segment gives you exactly what you propose if I understand correctly.

@TheOnlyTails
Copy link
Author

Hmm, on second thought, I agree. The 2nd one might be worth considering though, since it's pretty hard to figure out you could use \uE0B6 and \uE0B4 to round off diamond segments.

@JanDeDobbeleer
Copy link
Owner

@TheOnlyTails we can always get to that point with communication s(or sample configs with these use-cases).

@JanDeDobbeleer
Copy link
Owner

@all-contributors please add @TheOnlyTails for ideas

@allcontributors
Copy link
Contributor

@JanDeDobbeleer

I've put up a pull request to add @TheOnlyTails! 🎉

@TheOnlyTails
Copy link
Author

TheOnlyTails commented Sep 24, 2021

Hmm, seems like <inherit>text</> doesn't work...

image

@JanDeDobbeleer
Copy link
Owner

JanDeDobbeleer commented Sep 24, 2021

Ah true, that's something I forgot. Will add.

EDIT: this is isn't an easy addition. Requires structural architectural changes. Need to think about this. Could as well turn out to be not supported for this usage.

@TheOnlyTails
Copy link
Author

Hmm, interesting.

@JanDeDobbeleer
Copy link
Owner

@TheOnlyTails found an "acceptable" solution after the initial refactoring. Should land soon.

@TheOnlyTails
Copy link
Author

That's great!

@JanDeDobbeleer
Copy link
Owner

@TheOnlyTails should be live

@TheOnlyTails
Copy link
Author

Wonderful!

@JanDeDobbeleer
Copy link
Owner

@TheOnlyTails with the change in #1180 the inherit keyword will be deprecated and replaced by both parentBackground and parentForeground. Just a heads-up.

@TheOnlyTails
Copy link
Author

got it, thanks for the heads up.

Copy link

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues.
If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🚀 feat New feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants