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

vis theme that accepts default terminal #1027

Closed
jgarte opened this issue Jul 21, 2022 · 22 comments
Closed

vis theme that accepts default terminal #1027

jgarte opened this issue Jul 21, 2022 · 22 comments

Comments

@jgarte
Copy link

jgarte commented Jul 21, 2022

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.

@qiu-x
Copy link
Contributor

qiu-x commented Jul 24, 2022

Try this one (decompress it first)

@jgarte
Copy link
Author

jgarte commented Jul 25, 2022

2022-07-25-181324_1600x900_scrot

@qiu-x
Copy link
Contributor

qiu-x commented Jul 26, 2022

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

@erf
Copy link
Contributor

erf commented Jul 26, 2022

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

See clear.lua

@mcepl
Copy link
Contributor

mcepl commented Jul 26, 2022

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?

@qiu-x
Copy link
Contributor

qiu-x commented Jul 26, 2022

screenshot

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

@erf
Copy link
Contributor

erf commented Jul 26, 2022

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.

@mcepl
Copy link
Contributor

mcepl commented Jul 26, 2022

@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

@erf
Copy link
Contributor

erf commented Jul 27, 2022

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.

@mcepl
Copy link
Contributor

mcepl commented Jul 27, 2022

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?

@erf
Copy link
Contributor

erf commented Jul 27, 2022

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.

@qiu-x
Copy link
Contributor

qiu-x commented Jul 28, 2022

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.

@erf
Copy link
Contributor

erf commented Jul 28, 2022

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?

@qiu-x
Copy link
Contributor

qiu-x commented Jul 28, 2022

@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

@erf
Copy link
Contributor

erf commented Jul 28, 2022

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

@erf
Copy link
Contributor

erf commented Aug 3, 2022

This PR #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.

@mcepl
Copy link
Contributor

mcepl commented Nov 30, 2022

What is the state of this ticket? What remains?

@erf
Copy link
Contributor

erf commented Nov 30, 2022

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

@apprehensions
Copy link
Contributor

local default_colors = { "black", "red", "green", "yellow", "blue", "magenta", "cyan", "white" }

@lobre
Copy link

lobre commented Feb 2, 2023

What do you mean @apprehensions?

@apprehensions
Copy link
Contributor

@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''

@lobre
Copy link

lobre commented Feb 2, 2023

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.

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

7 participants