From 561935ccd7226515f2ebe737e75aa658f4fb9727 Mon Sep 17 00:00:00 2001 From: JuanZoran <1430359574@qq.com> Date: Wed, 25 Jan 2023 11:18:30 +0800 Subject: [PATCH] feat: add theme option support --- README.md | 36 ++++++++++++--------------- lua/Trans/init.lua | 16 ++++-------- lua/Trans/theme.lua | 59 +++++++++++++++++++++++++++++++++++++++------ 3 files changed, 72 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index b2f2b52..4b90469 100644 --- a/README.md +++ b/README.md @@ -163,8 +163,8 @@ require'Trans'.setup { v = 'hover', }, hover = { - width = 36, - height = 26, + width = 37, + height = 27, border = 'rounded', title = { { '', 'TransTitleRound' }, @@ -192,7 +192,7 @@ require'Trans'.setup { 'CursorMoved', 'BufLeave', }, - auto_play = true, -- WARN : 请阅读说明 + auto_play = true, }, float = { width = 0.8, @@ -210,43 +210,37 @@ require'Trans'.setup { open = 'fold', close = 'fold', interval = 10, + }, + tag = { + wait = '#519aba', + fail = '#e46876', + success = '#10b981', + }, + engine = { + '本地', } }, - order = { - -- offline = { + order = { -- only work on hover mode 'title', 'tag', 'pos', 'exchange', 'translation', 'definition', - -- }, - -- online = { - -- -- TODO - -- }, }, icon = { star = '', - -- notfound = '❔', notfound = ' ', yes = ' ', no = '' + -- star = '⭐', + -- notfound = '❔', -- yes = '✔️', -- no = '❌' - -- star = '⭐', }, - + theme = 'default', -- 目前可选的: default, tokyonight, dracula db_path = '$HOME/.vim/dict/ultimate.db', - -- TODO : - -- engine = { - -- -- TODO - -- 'offline', - -- } - -- history = { - -- -- TOOD - -- } - -- TODO add online translate engine -- online_search = { -- enable = false, diff --git a/lua/Trans/init.lua b/lua/Trans/init.lua index 2a56cd9..9ebf9db 100644 --- a/lua/Trans/init.lua +++ b/lua/Trans/init.lua @@ -83,24 +83,18 @@ M.conf = { -- no = '❌' }, theme = 'default', + -- theme = 'dracula', + -- theme = 'tokyonight', + db_path = '$HOME/.vim/dict/ultimate.db', -- TODO : - -- engine = { - -- -- TODO - -- 'offline', - -- } + -- register word -- history = { -- -- TOOD -- } - -- TODO add online translate engine - -- online_search = { - -- enable = false, - -- engine = {}, - -- } - - -- TODO register word + -- TODO :add online translate engine } M.setup = function(opts) diff --git a/lua/Trans/theme.lua b/lua/Trans/theme.lua index c94292d..737936f 100644 --- a/lua/Trans/theme.lua +++ b/lua/Trans/theme.lua @@ -49,7 +49,7 @@ return { --- TODO : tokyonight = { TransWord = { - fg = '#7ee787', + fg = '#4ed4bc', bold = true, }, TransPhonetic = { @@ -57,14 +57,14 @@ return { }, TransTitle = { fg = '#0f0f15', - bg = '#75beff', + bg = '#82aaff', bold = true, }, TransTitleRound = { - fg = '#75beff', + fg = '#82aaff', }, TransTag = { - fg = '#e5c07b', + fg = '#6d8fda', }, TransExchange = { link = 'TransTag', @@ -76,7 +76,7 @@ return { link = 'TransWord', }, TransDefinition = { - link = 'Moremsg', + fg = '#82aaff', }, TransWin = { link = 'Normal', @@ -85,11 +85,56 @@ return { fg = '#8269b5', }, TransCollins = { - fg = '#faf743', + fg = '#cfa364', bold = true, }, TransFailed = { - fg = '#7aa89f', + fg = '#f4b085', + }, + }, + dracula = { + TransWord = { + fg = '#50fa7b', + bold = true, + }, + TransPhonetic = { + fg = '#6272a4', + }, + TransTitle = { + fg = '#0f0f15', + bg = '#bd93f9', + bold = true, + }, + TransTitleRound = { + fg = '#bd93f9', + }, + TransTag = { + fg = '#ffb86c', + }, + TransExchange = { + link = 'TransTag', + }, + TransPos = { + link = 'TransTag', + }, + TransTranslation = { + link = 'TransWord', + }, + TransDefinition = { + fg = '#8be9fd', + }, + TransWin = { + link = 'Normal', + }, + TransBorder = { + fg = '#9274c0', + }, + TransCollins = { + fg = '#f1fa8c', + bold = true, + }, + TransFailed = { + fg = '#8be9fd', }, }, }