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

How to Add rounded Edges ? #54

Open
escapingSamsara opened this issue Mar 2, 2024 · 2 comments
Open

How to Add rounded Edges ? #54

escapingSamsara opened this issue Mar 2, 2024 · 2 comments
Labels
question A question about the project

Comments

@escapingSamsara
Copy link

Hi!
I am using incline.nvim and i really like it so far !

I was wondering if it is possible to create rounded corners similar to my tmux status bar shown in the screenshot (top) and my lualine in neovim (bottom).

Appreciate any help !
Screenshot from 2024-03-02 01-06-08

@cvigilv
Copy link

cvigilv commented Mar 14, 2024

To achieve that behaviour, you can add the following characters ("" and "", Github doesn't render this) as prefix and suffix of the incline contents. This depend on having a font patched with Nerd font in order to work.

@b0o b0o added the question A question about the project label Apr 3, 2024
@okuuva
Copy link

okuuva commented Nov 12, 2024

Here's my render function that rounds the left edge before the icon:

local render = function(props)
  local helpers = require("incline.helpers")
  local devicons = require("nvim-web-devicons")
  local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
  if filename == "" then
    filename = "[No Name]"
  end
  local ft_icon, ft_color = devicons.get_icon_color(filename)
  local modified = vim.bo[props.buf].modified
  return {
    ft_icon and { "", guifg = ft_color } or "",
    ft_icon and { ft_icon, " ", guibg = ft_color, guifg = helpers.contrast_color(ft_color) } or "",
    " ",
    { filename, gui = modified and "bold,italic" or "bold" },
    " ",
  }
end

Adding ft_icon and { "", guifg = <filename color> }, at the bottom should do the trick if you want to round the right edge after the filename as well. Just use the same guifg as you do with your filename.

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

No branches or pull requests

4 participants