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

Set icons/symbols colors separately #67

Open
gldtn opened this issue May 11, 2024 · 9 comments
Open

Set icons/symbols colors separately #67

gldtn opened this issue May 11, 2024 · 9 comments

Comments

@gldtn
Copy link

gldtn commented May 11, 2024

Is it possible to set a default fg = "color" and set icon/symbol to a different color? For example in lualine, the fg, sets the color for each section and you can additionally set icon = { fg = "color", bg = "color" }.

Thanks!

@gldtn gldtn changed the title Set icons colors separately Set icons/symbols colors separately May 11, 2024
@gldtn
Copy link
Author

gldtn commented May 15, 2024

I did a little more digging and was able to get staline to look almost 100% the way I would like, but for that I had to modify your code. I would attempt to do a PR, but I barely know what I'm doing here 😆

Screenshot:
staline

For the file icon, I had to modify the file_name line in staline.lua, by separating file icon to its own line and removing the extra space from the left of the icon itself:

 M.sections['file_icon']        = "" .. f_icon .. " "
 M.sections['file_name']        = " " .. f_name .. edited .. ""

After modifying it I was able to do something like:

sections = {
        left = {
          { 'GoldSep',     'left_sep' },
          { 'Gold',        'mode' },
          { 'GoldSep',     'right_sep' },
          { 'LoveIconSep', 'left_sep' },
          { 'LoveIcon',    'file_icon' },
          { 'Love',        'file_name' },
          { 'LoveSep',     'right_sep' },
          'branch', 'diagnostics',
        },
        mid = {},
        right = {
          'lsp_name', ' ',
          { 'FoamIconSep', 'left_sep' },
          { 'FoamIcon', '' },
          { 'Foam', ' %l:%L' },
          { 'FoamSep', 'right_sep' },
          { 'GoldIconSep', 'left_sep' },
          { 'GoldIcon', '' },
          { 'Gold', ' %p%%' },
          { 'GoldSep', 'right_sep' },
        }
      },

I think by allowing to pull the icons separately on predefined sections it gives us more flexibility, I didn't attempt to do the mode_icons separate from mode_names as that is above my capabilities :/, but that would be a nice touch if it's something that is not implemented yet.

I also had to modify the lsp client names a bit to hind the #'s of clients count and the ( ) around it, if possible can you set an option for maybe lsp_clients_count = false?

Sorry for all the requests, and thank you for the awesome plugin!

@tamton-aquib
Copy link
Owner

Heyyo @gldtn,

These are excellent proposals. Some of them should have been like that from the beginning but i was not experienced back then to design it in a clean way 😅 .


About the file components, changing file_name to something else might be a breaking change for other users. How about if we have other components like f_name, f_icon and f_modified? file_name can stay unchanged which is a combination of the previous three. What do you think?


About mode_names, is it really necessary since we could edit mode_icons to have the names, for example:

require("staline").setup({
    mode_icons = {
        n = "[icon] NORMAL",
        i = "[icon] INSERT",
        -- etc...
    }
})

About the lsp client name part, I'm not too sure about how it is implemented since it was merged from a PR. I'll check and report back.

@gldtn
Copy link
Author

gldtn commented May 15, 2024

About the file components, changing file_name to something else might be a breaking change for other users. How about if we have other components like f_name, f_icon and f_modified? file_name can stay unchanged which is a combination of the previous three. What do you think?

That would be perfect.

About mode_names, is it really necessary since we could edit mode_icons to have the names, for example:

I was giving this one a thought, and tried playing with it a bit, but if I want to match the rest of the others sections like in my screenshot above, an it seems like I can't separate the icon from the name, or have different BGs for each. Would it be somewhat easy to implement a component called mode_names so it retrieves the name of the modes? If it's not too much of a headache of course.

About the lsp client name part, I'm not too sure about how it is implemented since it was merged from a PR. I'll check and report back.

Awesome, IMO the #'s of cliente and the (), it makes it look a bit cluttered or just "out of place"

These are excellent proposals. Some of them should have been like that from the beginning but i was not experienced back then to design it in a clean way 😅 .

I'm trying to learn a bit as I go myself! I've been using nvim for less than a year, barely new how to move around and here am I fiddling around plugin codes 😓. When I seen that you mentioned @vhyrro in the readme, I had to check the plugin out, his videos has been life changing to my nvim journey.

Thanks once again for creating this and taking you time to reply!

@tamton-aquib
Copy link
Owner

That would be perfect.

I'll start adding those then.

others sections like in my screenshot above, an it seems like I can't separate the icon from the name, or have different BGs for each.

Hmm yes that makes sense

Awesome, IMO the #'s of client and the (), it makes it look a bit cluttered or just "out of place"

Agreed, customizing components should be given to the users.

So I'll start with the first one right now. The second and third issue might need some thoughts.

When I seen that you mentioned @vhyrro in the readme, I had to check the plugin out, his videos has been life changing to my nvim journey.

Great dude, i have known him for nearly 4 years. He has taught me a lot from his discord server.

@gldtn
Copy link
Author

gldtn commented May 16, 2024

Hey, you might be still working on it, but testing out your recent commit, I see that you added f_icon_hl, can that be modified from the config? Adding a highlight.. { 'LoveIcon', 'f_icon' } doesn't seem to do the trick.

Thanks for the modifications.

@tamton-aquib
Copy link
Owner

f_icon actually respects the setup.defaults.true_colors option. Maybe I should remove that part 🤔

@gldtn
Copy link
Author

gldtn commented May 17, 2024

If there is no other way to override the highlight explicitly in the config perhaps for the granular option it would make since to remove it?

@tamton-aquib
Copy link
Owner

But users might want the highlight from nvim-web-devicon plugin 🤔 .

But I will take it off for now. Also for other issues, it might take some more time (Or if you come up with something and send a pr, thats fine too!)

@gldtn
Copy link
Author

gldtn commented May 19, 2024

Thank you for implementing this. If I come up with any ideas I'll send a pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants