-
Notifications
You must be signed in to change notification settings - Fork 268
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
Include a flag to replace the "circle" with a glyph from Nerd Fonts #1308
Comments
So you're proposing using the main language's logo as the "chip" for each language? TBH If we supported something like this I'd want to go a step further and show each language's nerdfont icon. |
Yes, I mean to assign their corresponding icons to each language, in the picture I just used the Rust icon because it was an easy change, I'm not really good at rust so I don't know how to implement the proposed change. |
No problem. Let's give this issue some time for discussion before you make any contributions . In case we close this as "not planned" I wouldn't want you to do work unnecessarily. But even just updating |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Is this as simple as adding a value in This is an example of a possible solution.
the only issues that i can see arising from this are whether or not to enable this by default, and whether there should be a |
I've done a basic implementation without a flag, I've got most of the basic functionality worked out, but there's still a few issues that need to be worked out,
If there's no glaring issues I'm missing, I'll make a pull request. |
lol. my colorscheme doesn't contrast very well with the chip colour for these langs, but even then all of the characters are one space wide. I don't know of any way to get around that though. |
#1308 (comment) Just happened to show two of the more detailed, and therefore hard to see, logos. It's not so bad with the C logo. @Localghost385 you might be able to get a head-start by referencing the contributions here: spenserblack/gengo#345 and spenserblack/gengo#348. But I believe some invalid codes were included 😢 |
I'll definitely check spenserblack/gengo#345 and spenserblack/gengo#348 In regards to legibility, there may be an argument for not using the logo for some languages like makefile? |
You might be able to find a alternate glyphs for some. For Makefile, for example, try or instead of |
@Localghost385 FYI, if you're going to use the escapes: spenserblack/gengo#435 For example, for Rust (), use Though I guess that depends on if you're planning on putting the literal nerd font character or its escaped Unicode in the data file (personally I prefer using escapes). |
@spenserblack But i could handle them in a more standard format, It's not a big change, but at the same time I don't know if it's an issue to keep it this way. |
Oh, are you hard-coding these in the Rust code? You probably want to put it in |
this is in the in
the error occurs in the rust code generated from the yaml in
|
Oh, OK, now I understand what you're doing. It's a literal string (not an escape) in the YAML, and then gets output just as it is in the template. So it's kind of like you're writing Rust strings, not YAML strings. Sorry, I missed that the snippets you were posting were YAML and not Rust. This brings up an interesting thought: what should we ask/expect contributors to know? The Rust syntax for writing Unicode, or the YAML syntax? |
The standard way seems best to me really. If there's already a precedent of handling them that way (in gengo), and it's what most people will be used to it's probably the best solution. |
In gengo's scenario it was ideal to do it that way, for 2 reasons:
Onefetch, like tokei, doesn't write tokens, but uses a templating language. So there's a bit more freedom in that you can write Rust syntax directly in the data. So it really comes down to a matter of preference I think. There's a bit of overlap between tokei and onefetch contributions. Tokei has set the precedent of writing Rust syntax in the data file (even going so far as requiring double escapes, 1 for JSON and 1 for Rust). At this point I'm leaning slightly towards YAML escapes instead of Rust escapes, but I don't really have a strong opinion one way or the other. Just raising the question for consideration. @o2sh thoughts? |
Ideally, we would use the Nerd Font code point verbatim inside This means using |
If we're fine with having the actual character in the generated code instead of the escape, I don't think we actually need to perform a conversion. # input
nerd-font-icon: "\U0000e7a8" // output
fn get_nerd_font_icon(&self) -> Option<char> {
match self {
// ...
Rust => '',
// ...
}
} |
I created a pr to get some feedback on the icons, most of the functionality is there but there's still some issues to be worked out. |
Summary 💡
Currently in the languages section a circle using the "chip" color is printed along the programming language name, it would be more attractive to the eye to have the colored logo of the programming language instead of the circle.
Motivation 🔦
In the Nerd Fonts project there are a lot of glyphs directly related to a lot of programming languages (see non extensive list below, to be updated later).
If a new entry in the config file is added, users could include the glyph if it exists and onefetch could replace the circle with that.
Example:
The text was updated successfully, but these errors were encountered: