diff options
| author | Randy Palamar <randy@rnpnr.xyz> | 2023-10-19 07:19:00 -0600 |
|---|---|---|
| committer | Randy Palamar <randy@rnpnr.xyz> | 2024-03-25 21:09:42 -0600 |
| commit | 95bf9f59f8a9a37148bdc0787db378d62c7cd032 (patch) | |
| tree | 01c8c6e8f51260cef7fa048d0f7472ab93a4a327 /lua | |
| parent | 49442e5178296a58f8ca2e267a93b89c5cca8e5b (diff) | |
| download | vis-95bf9f59f8a9a37148bdc0787db378d62c7cd032.tar.gz vis-95bf9f59f8a9a37148bdc0787db378d62c7cd032.tar.xz | |
ui: refactor style handling
The old style handling had a lot edge cases where one of the
colours or the attribute wouldn't get applied correctly. This
commit adds a new style_set() method to the Ui which should be
called instead of manually touching a cell's style. This also
means that the Cell struct can be made opaque since all the
handling is now done inside the ui-terminal files.
With this it is now viable to combine the light and dark 16 colour
themes into a single base-16 theme. This theme works very well
with the Linux virtual console and will now be the default theme
regardless of if the terminal supports 256 colours or not. This
should address the common complaints about vis not respecting the
users default terminal colours.
fixes #1151: Theming is sometimes partially applied or ignored
see #1103: terminal no longer has transparency/opacity
see #1040: Transparent background and setting options by default
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/themes/base-16.lua (renamed from lua/themes/dark-16.lua) | 15 | ||||
| l--------- | lua/themes/default-16.lua | 1 | ||||
| l--------- | lua/themes/default-256.lua | 1 | ||||
| l--------- | lua/themes/default.lua | 1 | ||||
| -rw-r--r-- | lua/themes/light-16.lua | 37 | ||||
| -rw-r--r-- | lua/vis-std.lua | 4 |
6 files changed, 10 insertions, 49 deletions
diff --git a/lua/themes/dark-16.lua b/lua/themes/base-16.lua index fd7e1db..f334e11 100644 --- a/lua/themes/dark-16.lua +++ b/lua/themes/base-16.lua @@ -1,8 +1,7 @@ -- Eight-color scheme local lexers = vis.lexers --- dark -lexers.STYLE_DEFAULT ='back:black,fore:white' -lexers.STYLE_NOTHING = 'back:black' +lexers.STYLE_DEFAULT ='' +lexers.STYLE_NOTHING = '' lexers.STYLE_CLASS = 'fore:yellow,bold' lexers.STYLE_COMMENT = 'fore:blue,bold' lexers.STYLE_CONSTANT = 'fore:cyan,bold' @@ -21,17 +20,17 @@ lexers.STYLE_TYPE = 'fore:green,bold' lexers.STYLE_VARIABLE = 'fore:blue,bold' lexers.STYLE_WHITESPACE = '' lexers.STYLE_EMBEDDED = 'back:blue,bold' -lexers.STYLE_IDENTIFIER = 'fore:white' +lexers.STYLE_IDENTIFIER = '' -lexers.STYLE_LINENUMBER = 'fore:white' +lexers.STYLE_LINENUMBER = '' lexers.STYLE_LINENUMBER_CURSOR = lexers.STYLE_LINENUMBER -lexers.STYLE_CURSOR = 'reverse' +lexers.STYLE_CURSOR = 'back:white,fore:black' lexers.STYLE_CURSOR_PRIMARY = lexers.STYLE_CURSOR..',fore:yellow' lexers.STYLE_CURSOR_LINE = 'underlined' lexers.STYLE_COLOR_COLUMN = 'back:red' -lexers.STYLE_SELECTION = 'back:white' +lexers.STYLE_SELECTION = 'back:white,bold' lexers.STYLE_STATUS = 'reverse' lexers.STYLE_STATUS_FOCUSED = 'reverse,bold' lexers.STYLE_SEPARATOR = lexers.STYLE_DEFAULT -lexers.STYLE_INFO = 'fore:default,back:default,bold' +lexers.STYLE_INFO = 'bold' lexers.STYLE_EOF = '' diff --git a/lua/themes/default-16.lua b/lua/themes/default-16.lua deleted file mode 120000 index 51192b4..0000000 --- a/lua/themes/default-16.lua +++ /dev/null @@ -1 +0,0 @@ -dark-16.lua
\ No newline at end of file diff --git a/lua/themes/default-256.lua b/lua/themes/default-256.lua deleted file mode 120000 index e12776c..0000000 --- a/lua/themes/default-256.lua +++ /dev/null @@ -1 +0,0 @@ -zenburn.lua
\ No newline at end of file diff --git a/lua/themes/default.lua b/lua/themes/default.lua new file mode 120000 index 0000000..2813d85 --- /dev/null +++ b/lua/themes/default.lua @@ -0,0 +1 @@ +base-16.lua
\ No newline at end of file diff --git a/lua/themes/light-16.lua b/lua/themes/light-16.lua deleted file mode 100644 index 53d0e45..0000000 --- a/lua/themes/light-16.lua +++ /dev/null @@ -1,37 +0,0 @@ --- Eight-color scheme -local lexers = vis.lexers --- light -lexers.STYLE_DEFAULT = 'back:white,fore:black' -lexers.STYLE_NOTHING = 'back:white' -lexers.STYLE_CLASS = 'fore:yellow,bold' -lexers.STYLE_COMMENT = 'fore:blue,bold' -lexers.STYLE_CONSTANT = 'fore:cyan,bold' -lexers.STYLE_DEFINITION = 'fore:blue,bold' -lexers.STYLE_ERROR = 'fore:red,italics' -lexers.STYLE_FUNCTION = 'fore:blue,bold' -lexers.STYLE_KEYWORD = 'fore:yellow,bold' -lexers.STYLE_LABEL = 'fore:green,bold' -lexers.STYLE_NUMBER = 'fore:red,bold' -lexers.STYLE_OPERATOR = 'fore:cyan,bold' -lexers.STYLE_REGEX = 'fore:green,bold' -lexers.STYLE_STRING = 'fore:red,bold' -lexers.STYLE_PREPROCESSOR = 'fore:magenta,bold' -lexers.STYLE_TAG = 'fore:red,bold' -lexers.STYLE_TYPE = 'fore:green,bold' -lexers.STYLE_VARIABLE = 'fore:blue,bold' -lexers.STYLE_WHITESPACE = '' -lexers.STYLE_EMBEDDED = 'back:blue,bold' -lexers.STYLE_IDENTIFIER = 'fore:black' - -lexers.STYLE_LINENUMBER = 'fore:black' -lexers.STYLE_LINENUMBER_CURSOR = lexers.STYLE_LINENUMBER -lexers.STYLE_CURSOR = 'reverse' -lexers.STYLE_CURSOR_PRIMARY = lexers.STYLE_CURSOR..',fore:yellow' -lexers.STYLE_CURSOR_LINE = 'underlined' -lexers.STYLE_COLOR_COLUMN = 'back:red' -lexers.STYLE_SELECTION = 'back:black' -lexers.STYLE_STATUS = 'reverse' -lexers.STYLE_STATUS_FOCUSED = 'reverse,bold' -lexers.STYLE_SEPARATOR = lexers.STYLE_DEFAULT -lexers.STYLE_INFO = 'fore:default,back:default,bold' -lexers.STYLE_EOF = '' diff --git a/lua/vis-std.lua b/lua/vis-std.lua index 971d247..8b5715b 100644 --- a/lua/vis-std.lua +++ b/lua/vis-std.lua @@ -2,9 +2,9 @@ vis.events.subscribe(vis.events.INIT, function() if os.getenv("TERM_PROGRAM") == "Apple_Terminal" then - vis:command("set change256colors false"); + vis:command("set change256colors false") end - vis:command("set theme ".. (vis.ui.colors <= 16 and "default-16" or "default-256")) + vis:command("set theme default") end) vis:option_register("theme", "string", function(name) |
