feat: add theme option support

This commit is contained in:
JuanZoran 2023-01-25 11:18:30 +08:00
parent 934231183d
commit 561935ccd7
3 changed files with 72 additions and 39 deletions

View File

@ -163,8 +163,8 @@ require'Trans'.setup {
v = 'hover', v = 'hover',
}, },
hover = { hover = {
width = 36, width = 37,
height = 26, height = 27,
border = 'rounded', border = 'rounded',
title = { title = {
{ '', 'TransTitleRound' }, { '', 'TransTitleRound' },
@ -192,7 +192,7 @@ require'Trans'.setup {
'CursorMoved', 'CursorMoved',
'BufLeave', 'BufLeave',
}, },
auto_play = true, -- WARN : 请阅读说明 auto_play = true,
}, },
float = { float = {
width = 0.8, width = 0.8,
@ -210,43 +210,37 @@ require'Trans'.setup {
open = 'fold', open = 'fold',
close = 'fold', close = 'fold',
interval = 10, interval = 10,
},
tag = {
wait = '#519aba',
fail = '#e46876',
success = '#10b981',
},
engine = {
'本地',
} }
}, },
order = { order = { -- only work on hover mode
-- offline = {
'title', 'title',
'tag', 'tag',
'pos', 'pos',
'exchange', 'exchange',
'translation', 'translation',
'definition', 'definition',
-- },
-- online = {
-- -- TODO
-- },
}, },
icon = { icon = {
star = '', star = '',
-- notfound = '❔',
notfound = ' ', notfound = ' ',
yes = ' ', yes = ' ',
no = '' no = ''
-- star = '⭐',
-- notfound = '❔',
-- yes = '✔️', -- yes = '✔️',
-- no = '❌' -- no = '❌'
-- star = '⭐',
}, },
theme = 'default', -- 目前可选的: default, tokyonight, dracula
db_path = '$HOME/.vim/dict/ultimate.db', db_path = '$HOME/.vim/dict/ultimate.db',
-- TODO :
-- engine = {
-- -- TODO
-- 'offline',
-- }
-- history = {
-- -- TOOD
-- }
-- TODO add online translate engine -- TODO add online translate engine
-- online_search = { -- online_search = {
-- enable = false, -- enable = false,

View File

@ -83,24 +83,18 @@ M.conf = {
-- no = '❌' -- no = '❌'
}, },
theme = 'default', theme = 'default',
-- theme = 'dracula',
-- theme = 'tokyonight',
db_path = '$HOME/.vim/dict/ultimate.db', db_path = '$HOME/.vim/dict/ultimate.db',
-- TODO : -- TODO :
-- engine = { -- register word
-- -- TODO
-- 'offline',
-- }
-- history = { -- history = {
-- -- TOOD -- -- TOOD
-- } -- }
-- TODO add online translate engine -- TODO :add online translate engine
-- online_search = {
-- enable = false,
-- engine = {},
-- }
-- TODO register word
} }
M.setup = function(opts) M.setup = function(opts)

View File

@ -49,7 +49,7 @@ return {
--- TODO : --- TODO :
tokyonight = { tokyonight = {
TransWord = { TransWord = {
fg = '#7ee787', fg = '#4ed4bc',
bold = true, bold = true,
}, },
TransPhonetic = { TransPhonetic = {
@ -57,14 +57,14 @@ return {
}, },
TransTitle = { TransTitle = {
fg = '#0f0f15', fg = '#0f0f15',
bg = '#75beff', bg = '#82aaff',
bold = true, bold = true,
}, },
TransTitleRound = { TransTitleRound = {
fg = '#75beff', fg = '#82aaff',
}, },
TransTag = { TransTag = {
fg = '#e5c07b', fg = '#6d8fda',
}, },
TransExchange = { TransExchange = {
link = 'TransTag', link = 'TransTag',
@ -76,7 +76,7 @@ return {
link = 'TransWord', link = 'TransWord',
}, },
TransDefinition = { TransDefinition = {
link = 'Moremsg', fg = '#82aaff',
}, },
TransWin = { TransWin = {
link = 'Normal', link = 'Normal',
@ -85,11 +85,56 @@ return {
fg = '#8269b5', fg = '#8269b5',
}, },
TransCollins = { TransCollins = {
fg = '#faf743', fg = '#cfa364',
bold = true, bold = true,
}, },
TransFailed = { 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',
}, },
}, },
} }