vis icon indicating copy to clipboard operation
vis copied to clipboard

vis theme that accepts default terminal

Open jgarte opened this issue 3 years ago • 16 comments

Hi is there a vis theme that just allows the default terminal to passthrough?

Nano on the left and vis on the right:

image

I'd like for vis to be like the nano color on the left which is just my kitty default terminal theme.

jgarte avatar Jul 21 '22 00:07 jgarte

Try this one (decompress it first)

qiu-x avatar Jul 24 '22 21:07 qiu-x

2022-07-25-181324_1600x900_scrot

jgarte avatar Jul 25 '22 23:07 jgarte

Oops, I forgot to also pass-through the foreground color. Here you go.

qiu-x avatar Jul 26 '22 07:07 qiu-x

I tried something similar in https://github.com/erf/vis-minimal-theme

See clear.lua

erf avatar Jul 26 '22 09:07 erf

I tried something similar in https://github.com/erf/vis-minimal-theme

See clear.lua

This is actually interesting. Why wouldn’t you submit it here as PR?

mcepl avatar Jul 26 '22 10:07 mcepl

screenshot

clear.lua from https://github.com/erf/vis-minimal-theme is setting the foreground color just as my theme did before.

qiu-x avatar Jul 26 '22 16:07 qiu-x

Yes i still do custom theming. I only set the background color to transparent. I don't think there is a way to get the terminal color.

erf avatar Jul 26 '22 17:07 erf

@qiu-x Is this the transformation of your changes to vis-minimal-theme:

diff --git a/clear.lua b/clear.lua
index 4a7487f..e2a4b49 100644
--- a/clear.lua
+++ b/clear.lua
@@ -13,7 +13,7 @@ local clear0 = '#00000000'
 
 local lexers = vis.lexers
 
-lexers.STYLE_DEFAULT ='back:'..clear0..',fore:'..black0
+lexers.STYLE_DEFAULT =''
 lexers.STYLE_NOTHING = 'back:'..white0
 lexers.STYLE_CLASS = 'fore:'..black0
 lexers.STYLE_COMMENT = 'fore:'..white2
@@ -33,14 +33,14 @@ lexers.STYLE_TYPE = 'fore:'..black0
 lexers.STYLE_VARIABLE = 'fore:'..black0
 lexers.STYLE_WHITESPACE = ''
 lexers.STYLE_EMBEDDED = 'back:'..white1
-lexers.STYLE_IDENTIFIER = 'fore:'..black0
+lexers.STYLE_IDENTIFIER = ''
 
-lexers.STYLE_LINENUMBER = 'fore:'..black1
+-- lexers.STYLE_LINENUMBER = 'fore:'..black1
 lexers.STYLE_LINENUMBER_CURSOR = lexers.STYLE_LINENUMBER
 lexers.STYLE_CURSOR = 'back:'..white2
 lexers.STYLE_CURSOR_PRIMARY = lexers.STYLE_CURSOR..',fore:'..black1
 lexers.STYLE_CURSOR_LINE = 'underlined'
-lexers.STYLE_COLOR_COLUMN = 'back:'..white1
+lexers.STYLE_COLOR_COLUMN = 'back:'..'#d3d7cf'
 lexers.STYLE_SELECTION = 'back:'..white1
 lexers.STYLE_STATUS = 'reverse'
 lexers.STYLE_STATUS_FOCUSED = 'back:'..white1..',fore:'..black1

mcepl avatar Jul 26 '22 19:07 mcepl

I added a dark-clear.lua and light-clear.lua now in https://github.com/erf/vis-minimal-theme for use with both black and white terminal backgrounds.

erf avatar Jul 27 '22 08:07 erf

I added a dark-clear.lua and light-clear.lua now in https://github.com/erf/vis-minimal-theme for use with both black and white terminal backgrounds.

I don’t understand … isn’t the point of clear theme that it shouldn’t interfere with the terminal settings, i.e., it shouldn’t matter you have set as a background?

mcepl avatar Jul 27 '22 08:07 mcepl

It only sets the background of vis to clear. The foreground is either set to a black or white color scheme. There is no way to get the terminal foreground color.

erf avatar Jul 27 '22 09:07 erf

There is no way to get the terminal foreground color.

Actually, there is. vis by default (without any theme enabled) uses the terminal foreground color. So if the theme doesn't override it, like here:

 lexers.STYLE_DEFAULT        = ''

Then the foreground color will be used.

qiu-x avatar Jul 28 '22 07:07 qiu-x

Oh i did not know that. That's awesome! I wish the terminal foreground color was available in the Lua API so we could is it to makes shades / palette of that color, but i guess it's one thing to print text with the color but another thing to actually get the color from the terminal as there is not a common terminal control code to actually get the color AFAIK.

PS: I updated https://github.com/erf/vis-minimal-theme to include a clear.lua now to use the terminal color and no syntax highlighting.

Is it possible to use the terminal cursor colors for background and foreground?

erf avatar Jul 28 '22 10:07 erf

@qiu-x Is this the transformation of your changes to vis-minimal-theme:

Honestly, I think it's not possible to use any predefined colors in a theme that is supposed to work with any background color. But we can use italics/bold/underline to compensate.

-- vis-minimal-theme (https://github.com/erf/vis-minimal-theme)
-- clear by Erlend Lind Madsen
-- uses a transparent background and the terminal foreground
-- Now with extra syntax highlighting ;^)

local white2 = '#989898'
local clear0 = '#00000000'

local lexers = vis.lexers

lexers.STYLE_DEFAULT ='back:'..clear0
lexers.STYLE_NOTHING = ''
lexers.STYLE_CLASS = 'fore:,bold'
lexers.STYLE_COMMENT = 'fore:,italics'
lexers.STYLE_CONSTANT = 'fore:'
lexers.STYLE_DEFINITION = 'fore:'
lexers.STYLE_ERROR = 'fore:,bold'
lexers.STYLE_FUNCTION = 'fore:,bold'
lexers.STYLE_KEYWORD = 'fore:,bold'
lexers.STYLE_LABEL = 'fore:,underline'
lexers.STYLE_NUMBER = 'fore:'
lexers.STYLE_OPERATOR = 'fore:'
lexers.STYLE_REGEX = 'fore:,italics'
lexers.STYLE_STRING = 'fore:,italics'
lexers.STYLE_PREPROCESSOR = 'fore:,bold'
lexers.STYLE_TAG = 'fore:,underline'
lexers.STYLE_TYPE = 'fore:,bold'
lexers.STYLE_VARIABLE = 'fore:'
lexers.STYLE_WHITESPACE = ''
lexers.STYLE_EMBEDDED = 'back:'..clear0
lexers.STYLE_IDENTIFIER = 'fore:'

lexers.STYLE_LINENUMBER = 'fore:'
lexers.STYLE_LINENUMBER_CURSOR = lexers.STYLE_LINENUMBER
lexers.STYLE_CURSOR = 'back:'..white2
lexers.STYLE_CURSOR_PRIMARY = lexers.STYLE_CURSOR
lexers.STYLE_CURSOR_LINE = 'underlined'
lexers.STYLE_COLOR_COLUMN = 'back:'..white2
lexers.STYLE_SELECTION = 'back:'..white2
lexers.STYLE_STATUS = 'reverse'
lexers.STYLE_STATUS_FOCUSED = 'back:'..white2
lexers.STYLE_SEPARATOR = lexers.STYLE_DEFAULT
lexers.STYLE_INFO = 'fore:default,back:default'
lexers.STYLE_EOF = ''

Edit: screenshot

qiu-x avatar Jul 28 '22 16:07 qiu-x

Nice! Added it. Feel free to make PR's to improve further.

erf avatar Jul 28 '22 19:07 erf

This PR https://github.com/martanne/vis/pull/953 allows using the terminal cursor color! (I wish there was still a way to override it)

I also wish was possible to set STYLE_SELECTION blank and use the terminal selection color.

erf avatar Aug 03 '22 20:08 erf

What is the state of this ticket? What remains?

mcepl avatar Nov 30 '22 19:11 mcepl

I think this can be closed - I've mentioned the vis-minimal-theme, you can use clear.lua to use the terminal background / foreground.

erf avatar Nov 30 '22 19:11 erf

https://github.com/martanne/vis/blob/b828b5b986a576196cda2ccba13579de96772ebd/lua/vis-std.lua#L22

sewnie avatar Feb 02 '23 13:02 sewnie

What do you mean @apprehensions?

lobre avatar Feb 02 '23 13:02 lobre

@ninewise said my issue was a duplicate, without telling me vis actually has native terminal colorscheme support, just lacking some colors. i just pointed the vis-std to it to ''clarify''

sewnie avatar Feb 02 '23 13:02 sewnie

Ok, I see. Thanks for clarifying. Don’t forget that people are subscribed to issues, and don’t necessarily have the context of other issues when receiving notifications, or when reading an issue from top to bottom. So context is important when writing comments.

lobre avatar Feb 02 '23 16:02 lobre