v/GTT
1
0
mirror of https://github.com/eeeXun/GTT.git synced 2025-05-19 09:10:42 -07:00

use color_theme

This commit is contained in:
eeeXun 2022-10-18 23:51:17 +08:00
parent fb41d7ef5c
commit bea89309a8
2 changed files with 64 additions and 26 deletions

60
color.go Normal file
View File

@ -0,0 +1,60 @@
package main
import (
"github.com/gdamore/tcell/v2"
)
type color_theme struct {
bg tcell.Color
fg tcell.Color
red tcell.Color
green tcell.Color
yellow tcell.Color
blue tcell.Color
purple tcell.Color
cyan tcell.Color
}
var (
Gruvbox color_theme = color_theme{
bg: tcell.NewHexColor(0x282828),
fg: tcell.NewHexColor(0xebdbb2),
red: tcell.NewHexColor(0xfb4934),
green: tcell.NewHexColor(0xfabd2f),
yellow: tcell.NewHexColor(0xfabd2f),
blue: tcell.NewHexColor(0x83a598),
purple: tcell.NewHexColor(0xd3869b),
cyan: tcell.NewHexColor(0x8ec07c),
}
Nord color_theme = color_theme{
bg: tcell.NewHexColor(0x3b4252),
fg: tcell.NewHexColor(0xeceff4),
red: tcell.NewHexColor(0xbf616a),
green: tcell.NewHexColor(0xa3be8c),
yellow: tcell.NewHexColor(0xebcb8b),
blue: tcell.NewHexColor(0x81a1c1),
purple: tcell.NewHexColor(0xb48ead),
cyan: tcell.NewHexColor(0x8fbcbb),
}
)
type Colors struct {
background_color tcell.Color
border_color tcell.Color
foreground_color tcell.Color
text_color tcell.Color
}
type Window struct {
src Colors
dest Colors
}
func (w *Window) color_init() {
w.src.background_color = Nord.bg
w.src.border_color = Nord.yellow
w.src.foreground_color = Nord.fg
w.dest.background_color = Nord.bg
w.dest.border_color = Nord.blue
w.dest.foreground_color = Nord.fg
}

30
ui.go
View File

@ -2,36 +2,14 @@ package main
import (
"github.com/gdamore/tcell/v2"
// "github.com/rivo/tview"
)
type Colors struct {
background_color tcell.Color
border_color tcell.Color
foreground_color tcell.Color
text_color tcell.Color
}
type Window struct {
src Colors
dest Colors
}
func (w *Window) color_init() {
w.src.background_color = tcell.ColorDefault
w.src.border_color = tcell.NewHexColor(0xFBF1C7)
w.src.foreground_color = tcell.NewHexColor(0xFBF1C7)
w.dest.background_color = tcell.ColorDefault
w.dest.border_color = tcell.NewHexColor(0xFBF1C7)
w.dest.foreground_color = tcell.NewHexColor(0xFBF1C7)
}
func ui_init() {
src_box.SetBorder(true).
SetTitle(translator.src_lang).
SetBorderColor(window.src.border_color).
SetTitleColor(window.src.border_color)
src_box.SetBackgroundColor(window.src.background_color)
SetTitleColor(window.src.border_color).
SetBackgroundColor(window.src.background_color)
src_box.SetTextStyle(tcell.StyleDefault.
Background(window.src.background_color).
Foreground(window.src.foreground_color))
@ -39,6 +17,6 @@ func ui_init() {
dest_box.SetBorder(true).
SetTitle(translator.dest_lang).
SetBorderColor(window.dest.border_color).
SetTitleColor(window.dest.border_color)
dest_box.SetBackgroundColor(window.dest.background_color)
SetTitleColor(window.dest.border_color).
SetBackgroundColor(window.dest.background_color)
}