Coder Social home page Coder Social logo

Comments (5)

terriblephrases avatar terriblephrases commented on August 27, 2024 1

I tried xterm and urxvt and they do the same thing as st here - the cursor color stays the same across ":set bg=light/dark".

The reason Alacritty behaves differently seems to be it automatically reverses cursor color, rather than use a set one.
Here's a StackExchange question with answers on the same issue.

A solution would be to set the defaultbg, defaultcs etc to their their own indexes after 255 in st's config.h:

static const char *colorname[] = {
    [256] = "#282828",
    [258] = "#ebdbb2",
};
unsigned int defaultbg = 256;
static unsigned int defaultcs = 258;

// If you want to set cursor color with Xresources, you need this:
ResourcePref resources[] = {
// Luke removed the cursorColor line earlier today
// If you want to set the cursor color with Xresources, put it back
    { "cursorColor",  STRING,  &colorname[258] },
};

... and put this in .vimrc:

	" set st cursor and background to contrasting colors on start
	silent !echo -ne "\033]4;258;\#3c3836\x7\033]4;256;\#fbf1c7\x7"
	" reset cursor and background  when vim exits
	autocmd VimLeave * silent !echo -ne "\033]104;258\x7\033]104;256\x7"

	" You can also change colors depending on Vim mode:
	" use an orange cursor in insert mode
	let &t_SI = "\033]4;258;orange\x7"
	" use red cursor otherwise
	let &t_EI = "\033]4;258;red\x7"

]4;colorindex;colorname is one of few a OSC escape codes st implements
]104;colorindex resets color index to default

Result:
image

from st.

LukeSmithxyz avatar LukeSmithxyz commented on August 27, 2024

Did you set these colors in Xresources or in the source code?

I just activated gruvbox light colors from Xresources and I don't get this problem in neovim. Mind showing exactly what your settings/changes are?

from st.

thekaganugur avatar thekaganugur commented on August 27, 2024

Did you set these colors in Xresources or in the source code?

I just activated gruvbox light colors from Xresources and I don't get this problem in neovim. Mind showing exactly what your settings/changes are?

I just changed Xresources to gruvbox light and problem disappeared. Yet I want to use dark scheme for the terminal itself. In Vim I change color-scheme to light on daylight, dark scheme otherwise. Do I need to change Xresources for this? I don't understand how this works. I basically use morhetz/gruvbox plugin. Doesn't it overwrite all those values?
In alacritty default color-scheme for terminal is dark, yet the problem doesn't happen.

from st.

LukeSmithxyz avatar LukeSmithxyz commented on August 27, 2024

So you want a dark terminal but a light vim? Your problem is probably that the vim colorscheme doesn't set a cursor color for each them. I guess you can add that manually if you'd like (I suppose it's possible, but I don't know about or use vim colorschemes).

from st.

thekaganugur avatar thekaganugur commented on August 27, 2024

@terriblephrases Thank you for clarifying the problem.

from st.

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.