Просмотр исходного кода

Change default theme to Dracula

rigormorrtiss 4 лет назад
Родитель
Сommit
7fe268b813
3 измененных файлов с 34 добавлено и 17 удалено
  1. 15 2
      discordo.go
  2. 3 3
      util/discord.go
  3. 16 12
      util/theme.go

+ 15 - 2
discordo.go

@@ -30,6 +30,19 @@ var (
 )
 )
 
 
 func main() {
 func main() {
+	tview.Borders.HorizontalFocus = tview.Borders.Horizontal
+	tview.Borders.VerticalFocus = tview.Borders.Vertical
+	tview.Borders.TopLeftFocus = tview.Borders.TopLeft
+	tview.Borders.TopRightFocus = tview.Borders.TopRight
+	tview.Borders.BottomLeftFocus = tview.Borders.BottomLeft
+	tview.Borders.BottomRightFocus = tview.Borders.BottomRight
+	tview.Borders.Horizontal = ' '
+	tview.Borders.Vertical = ' '
+	tview.Borders.TopLeft = ' '
+	tview.Borders.TopRight = ' '
+	tview.Borders.BottomLeft = ' '
+	tview.Borders.BottomRight = ' '
+
 	theme = util.NewTheme()
 	theme = util.NewTheme()
 	loginModal = ui.NewLoginModal(onLoginModalDone)
 	loginModal = ui.NewLoginModal(onLoginModalDone)
 	guildsDropDown = ui.NewGuildsDropDown(onGuildsDropDownSelected, theme)
 	guildsDropDown = ui.NewGuildsDropDown(onGuildsDropDownSelected, theme)
@@ -167,7 +180,7 @@ func onGuildsDropDownSelected(text string, _ int) {
 
 
 		switch channel.Type {
 		switch channel.Type {
 		case discordgo.ChannelTypeGuildCategory:
 		case discordgo.ChannelTypeGuildCategory:
-			channelNode.SetColor(tcell.ColorDarkCyan)
+			channelNode.SetColor(tcell.GetColor(theme.TreeNodeForeground))
 			channelsTreeNode.AddChild(channelNode)
 			channelsTreeNode.AddChild(channelNode)
 		default:
 		default:
 			if channel.ParentID == "" {
 			if channel.ParentID == "" {
@@ -192,7 +205,7 @@ func onChannelsTreeViewSelected(node *tview.TreeNode) {
 			for i := range currentGuild.Channels {
 			for i := range currentGuild.Channels {
 				channel := currentGuild.Channels[i]
 				channel := currentGuild.Channels[i]
 				if channel.ParentID == currentChannel.ID {
 				if channel.ParentID == currentChannel.ID {
-					channelNode := tview.NewTreeNode(channel.Name).
+					channelNode := tview.NewTreeNode("[::d]#" + channel.Name + "[-:-:-]").
 						SetReference(channel)
 						SetReference(channel)
 					node.AddChild(channelNode)
 					node.AddChild(channelNode)
 				}
 				}

+ 3 - 3
util/discord.go

@@ -14,18 +14,18 @@ func WriteMessage(messagesTextView *tview.TextView, session *discordgo.Session,
 	var content strings.Builder
 	var content strings.Builder
 
 
 	if session.State.User.ID == message.Author.ID {
 	if session.State.User.ID == message.Author.ID {
-		content.WriteString("[#26BBD9::b]")
+		content.WriteString("[#50fa7b::b]")
 		content.WriteString(message.Author.Username)
 		content.WriteString(message.Author.Username)
 		content.WriteString("[-:-:-] ")
 		content.WriteString("[-:-:-] ")
 	} else {
 	} else {
-		content.WriteString("[#E95678::b]")
+		content.WriteString("[#ff5555::b]")
 		content.WriteString(message.Author.Username)
 		content.WriteString(message.Author.Username)
 		content.WriteString("[-:-:-] ")
 		content.WriteString("[-:-:-] ")
 	}
 	}
 
 
 	// If the author of the message is a bot account, add "BOT" beside the username of the author.
 	// If the author of the message is a bot account, add "BOT" beside the username of the author.
 	if message.Author.Bot {
 	if message.Author.Bot {
-		content.WriteString("[#29D398]BOT[-:-:-] ")
+		content.WriteString("[#bd93f9]BOT[-:-:-] ")
 	}
 	}
 
 
 	if message.Content != "" {
 	if message.Content != "" {

+ 16 - 12
util/theme.go

@@ -6,26 +6,30 @@ import (
 )
 )
 
 
 type Theme struct {
 type Theme struct {
-	DropDownBackground              string `json:"dropdown.background"`
+	DropDownBackground   string `json:"dropdown.background"`
+	TreeViewBackground   string `json:"treeview.background"`
+	TextViewBackground   string `json:"textview.background"`
+	InputFieldBackground string `json:"inputField.background"`
+
 	DropDownForeground              string `json:"dropdown.foreground"`
 	DropDownForeground              string `json:"dropdown.foreground"`
-	InputFieldBackground            string `json:"inputField.background"`
+	TextViewForeground              string `json:"textview.foreground"`
+	TreeNodeForeground              string `json:"treenode.foreground"`
 	InputFieldForeground            string `json:"inputField.foreground"`
 	InputFieldForeground            string `json:"inputField.foreground"`
 	InputFieldPlaceholderForeground string `json:"inputField.placeholderTextForeground"`
 	InputFieldPlaceholderForeground string `json:"inputField.placeholderTextForeground"`
-	TreeViewBackground              string `json:"treeview.background"`
-	TextViewBackground              string `json:"textview.background"`
-	TextViewForeground              string `json:"textview.foreground"`
 }
 }
 
 
 func NewTheme() *Theme {
 func NewTheme() *Theme {
 	var theme Theme
 	var theme Theme
-	theme.TextViewBackground = "#2E3440"
-	theme.TextViewForeground = "#D8DEE9"
-	theme.TreeViewBackground = "#2E3440"
-	theme.InputFieldBackground = "#3B4252"
-	theme.InputFieldForeground = "#D8DEE9"
-	theme.InputFieldPlaceholderForeground = "#D8DEE9"
 	theme.DropDownBackground = "#3B4252"
 	theme.DropDownBackground = "#3B4252"
-	theme.DropDownForeground = "#D8DEE9"
+	theme.TreeViewBackground = "#282a36"
+	theme.TextViewBackground = "#282a36"
+	theme.InputFieldBackground = "#3B4252"
+
+	theme.DropDownForeground = "#f8f8f2"
+	theme.TextViewForeground = "#f8f8f2"
+	theme.TreeNodeForeground = "#8be9fd"
+	theme.InputFieldForeground = "#f8f8f2"
+	theme.InputFieldPlaceholderForeground = "#6272a4"
 
 
 	userHomeDir, err := os.UserHomeDir()
 	userHomeDir, err := os.UserHomeDir()
 	if err != nil {
 	if err != nil {