diff --git a/color.go b/color.go index 6bedd97..defc065 100644 --- a/color.go +++ b/color.go @@ -5,8 +5,9 @@ import ( ) var ( - themes_name = []string{"Gruvbox", "Nord"} - Themes = map[string]map[string]tcell.Color{ + themes_name = []string{"Gruvbox", "Nord"} + Transparent tcell.Color = tcell.ColorDefault + Themes = map[string]map[string]tcell.Color{ "Gruvbox": { "bg": tcell.NewHexColor(0x282828), "fg": tcell.NewHexColor(0xebdbb2), @@ -37,6 +38,7 @@ type Colors struct { foreground_color tcell.Color border_color tcell.Color text_color tcell.Color + title_color tcell.Color selected_color tcell.Color } @@ -46,11 +48,20 @@ type Window struct { } func (w *Window) color_init() { - w.src.background_color = Themes["Gruvbox"]["bg"] - w.src.border_color = Themes["Gruvbox"]["red"] - w.src.foreground_color = Themes["Gruvbox"]["fg"] - w.src.selected_color = Themes["Gruvbox"]["gray"] - w.dest.background_color = Themes["Gruvbox"]["bg"] - w.dest.border_color = Themes["Gruvbox"]["blue"] - w.dest.foreground_color = Themes["Gruvbox"]["fg"] + theme := "Gruvbox" + transparent := true + if transparent { + w.src.background_color = Transparent + w.dest.background_color = Transparent + } else { + w.src.background_color = Themes[theme]["bg"] + w.dest.background_color = Themes[theme]["bg"] + } + w.src.border_color = Themes[theme]["red"] + w.src.foreground_color = Themes[theme]["fg"] + w.src.title_color = Themes[theme]["yellow"] + w.src.selected_color = Themes[theme]["gray"] + w.dest.foreground_color = Themes[theme]["fg"] + w.dest.border_color = Themes[theme]["blue"] + w.dest.title_color = Themes[theme]["cyan"] } diff --git a/ui.go b/ui.go index e18dee4..89b62e6 100644 --- a/ui.go +++ b/ui.go @@ -8,7 +8,7 @@ func ui_init() { src_box.SetBorder(true). SetTitle(translator.src_lang). SetBorderColor(window.src.border_color). - SetTitleColor(window.src.border_color). + SetTitleColor(window.src.title_color). SetBackgroundColor(window.src.background_color) src_box.SetTextStyle(tcell.StyleDefault. Background(window.src.background_color). @@ -21,13 +21,15 @@ func ui_init() { dest_box.SetBorder(true). SetTitle(translator.dest_lang). SetBorderColor(window.dest.border_color). - SetTitleColor(window.dest.border_color). + SetTitleColor(window.dest.title_color). SetBackgroundColor(window.dest.background_color) dest_box.SetTextColor(window.dest.foreground_color) } func InputHandle(event *tcell.EventKey) *tcell.EventKey { key := event.Key() + // panic(event.Name()) + switch key { case tcell.KeyCtrlJ: result, err := translator.Translate(src_box.GetText()) @@ -39,9 +41,9 @@ func InputHandle(event *tcell.EventKey) *tcell.EventKey { case tcell.KeyCtrlQ: src_box.SetText("", true) case tcell.KeyCtrlN: - dest_box.SetText("NNN") + translator.PlaySound(translator.src_lang, src_box.GetText()) case tcell.KeyCtrlP: - dest_box.SetText("PPP") + translator.PlaySound(translator.dest_lang, dest_box.GetText(false)) case tcell.KeyCtrlT: dest_box.SetText("TTT") case tcell.KeyCtrlS: