Coder Social home page Coder Social logo

Comments (10)

ajslater avatar ajslater commented on May 15, 2024 1

from package-info.nvim.

ajslater avatar ajslater commented on May 15, 2024 1

I think I have a path to a solution

When you highlight the virtual text you use the highlight param guifg=#hexcode. I think guifg only works with termguicolor enabled. The highlight option that works with 256 colors is ctermfg=colorcode. e.g. ctermfg=136 would be the closest color to your outdated default.

So this would require a more complicated utils.helpers.M.register_highlight_group() that understands what mode to operate in and likely more complicated default options. Like if termguicolor is false, use ctermfg.

Unsure when I might get to a patch for this, but at least it's a way forward.

from package-info.nvim.

vuki656 avatar vuki656 commented on May 15, 2024

Hey, thanks for checking out the plugin.

I think I know what the problem is. I'll take care of it tomorrow morning.

from package-info.nvim.

vuki656 avatar vuki656 commented on May 15, 2024

Then virtual text colors are not observed. The rest of the display seems fine.

Just to be on the same page, when you say observed, you mean you get no colors at all if you disable icons? Would you mind sharing a screenshot?

I just tried disabling icons and am getting the highlight working on my end:
image

from package-info.nvim.

ajslater avatar ajslater commented on May 15, 2024

I just tried this morning and saw no color highlighting with icons enabled or disabled. Like many people I have a slew of plugins enabled so I created a new init.lua that only loads your plugin:

local cmd = vim.cmd -- Vim commands e.g. cmd('pwd')  
cmd 'packadd paq-nvim' -- load the package manager            
local paq = require('paq-nvim').paq  
paq {'savq/paq-nvim', opt = true} -- paq-nvim manages itself  
                                                              
paq {'vuki656/package-info.nvim'} -- package.json versioning  
require('package-info').setup {                               
    icons = {                                                 
        style = {
            up_to_date = "| =", -- Icon for up to date packages
            outdated = "| -", -- Icon for outdated packages       
        },                                                    
    }       
}           
                                                              
paq {'nanotech/jellybeans.vim'}  
cmd('colorscheme jellybeans')

And still no highlights in Terminal.app
term app

So I thought to myself, this thing might be intended to be used with truecolor, and possibly something's funky with my Terminal.app setup, so I downloaded iTerm2 and still no luck:
iterm2
with vim.opt.termguicolors enabled or disabled.

$ echo $TERM
xterm-256color

fwiw

its the same behavior with the jellybeans colorscheme or without.
I even tried opening a new terminals in iterm2 and Terminal.app that do not load my .bash_profile for a fresh environment and still no luck.

I'm struggling to figure out what could be unique about my setup.

from package-info.nvim.

ajslater avatar ajslater commented on May 15, 2024

Aha. I've got something.

  1. Colors do work in iTerm2 when vim.opt.termguicolors = true. I don't think they work at all without termguicolors
  2. Colors do not work when colorscheme jellybean is applied.
  3. Colors sometimes work inconsistently. This is very strange behavior. Sometimes only the up_to_date color is applied to all virtual text, even the outdated text. Its as if a terminal color reset code isn't being set. Other times it does work. It's almost like a caching problem. This is probably what concealed my earlier efforts to debug the problem.

Sad for me because I don't like iTerm2 and Terminal.app's color support sucks.

from package-info.nvim.

ajslater avatar ajslater commented on May 15, 2024

I suggest putting a warning about termguicolors being required to show colors in the README

It would be quite an enhancement for poor stubborn souls like me if you could get it to work with xterm256 colors as well.
And a smoother experience if you changed the defaults to be in the 256 color space. The closest translations to your defaults are LightSalmon3 (#d7875f) and Grey27 (#444444).

from package-info.nvim.

vuki656 avatar vuki656 commented on May 15, 2024

Wow, thanks for digging into this.

I don't really know that much about truecolor/termguicolors/etc... I remember messing with those when I was setting up my nvim config and once I got it working I set it and forgot about it.

I'll have to check if I can in any way detect what color mode is set by the user and adjust the colors accordingly.

What happens if you set the 256 supported colors through the config?

    colors = {
        up_to_date = "#3C4048", -- Text color for up to date package virtual text
        outdated = "#d19a66", -- Text color for outdated package virtual text
    },

from package-info.nvim.

vuki656 avatar vuki656 commented on May 15, 2024

Awesome. This does seem like a possible solution.

I'm currently on vacation so my dedicated time for this project is limited but when I get back in around a week I'll try to fix it.

If you get the time to setup a fix please use the develop branch since I reorganized the whole project there recently.

from package-info.nvim.

ajslater avatar ajslater commented on May 15, 2024

PR #42 submitted, with questions

from package-info.nvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.