Skip to content

Commit

Permalink
use map for themes
Browse files Browse the repository at this point in the history
  • Loading branch information
mistakenelf committed Oct 9, 2021
1 parent 1d1ff0d commit 516bd18
Showing 1 changed file with 56 additions and 56 deletions.
112 changes: 56 additions & 56 deletions internal/theme/theme.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,69 +56,69 @@ var colors = appColors{
spookyYellow: "#FF9A00 ",
}

var defaultTheme = Theme{
SelectedTreeItemColor: lipgloss.AdaptiveColor{Dark: colors.defaultPink, Light: colors.defaultPink},
UnselectedTreeItemColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
ActivePaneBorderColor: lipgloss.AdaptiveColor{Dark: colors.defaultPink, Light: colors.defaultPink},
InactivePaneBorderColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
SpinnerColor: lipgloss.AdaptiveColor{Dark: colors.defaultPink, Light: colors.defaultPink},
StatusBarSelectedFileForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarSelectedFileBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.defaultPink, Light: colors.defaultPink},
StatusBarBarForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarBarBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.darkGray, Light: colors.darkGray},
StatusBarTotalFilesForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarTotalFilesBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.defaultLightPurple, Light: colors.defaultLightPurple},
StatusBarLogoForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarLogoBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.defaultDarkPurple, Light: colors.defaultDarkPurple},
ErrorColor: lipgloss.AdaptiveColor{Dark: colors.red, Light: colors.red},
DefaultTextColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
}

var gruvboxTheme = Theme{
SelectedTreeItemColor: lipgloss.AdaptiveColor{Dark: colors.gruvOrange, Light: colors.gruvOrange},
UnselectedTreeItemColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
ActivePaneBorderColor: lipgloss.AdaptiveColor{Dark: colors.gruvGreen, Light: colors.gruvGreen},
InactivePaneBorderColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
SpinnerColor: lipgloss.AdaptiveColor{Dark: colors.red, Light: colors.red},
StatusBarSelectedFileForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarSelectedFileBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.red, Light: colors.red},
StatusBarBarForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarBarBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.darkGray, Light: colors.darkGray},
StatusBarTotalFilesForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarTotalFilesBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.gruvYellow, Light: colors.gruvYellow},
StatusBarLogoForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarLogoBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.gruvBlue, Light: colors.gruvBlue},
ErrorColor: lipgloss.AdaptiveColor{Dark: colors.red, Light: colors.red},
DefaultTextColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
}

var spookyTheme = Theme{
SelectedTreeItemColor: lipgloss.AdaptiveColor{Dark: colors.spookyOrange, Light: colors.spookyOrange},
UnselectedTreeItemColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
ActivePaneBorderColor: lipgloss.AdaptiveColor{Dark: colors.spookyOrange, Light: colors.spookyOrange},
InactivePaneBorderColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
SpinnerColor: lipgloss.AdaptiveColor{Dark: colors.red, Light: colors.red},
StatusBarSelectedFileForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarSelectedFileBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.spookyPurple, Light: colors.spookyPurple},
StatusBarBarForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarBarBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.black, Light: colors.black},
StatusBarTotalFilesForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarTotalFilesBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.spookyYellow, Light: colors.spookyYellow},
StatusBarLogoForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarLogoBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.spookyOrange, Light: colors.spookyOrange},
ErrorColor: lipgloss.AdaptiveColor{Dark: colors.red, Light: colors.red},
DefaultTextColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
var themeMap = map[string]Theme{
"default": {
SelectedTreeItemColor: lipgloss.AdaptiveColor{Dark: colors.defaultPink, Light: colors.defaultPink},
UnselectedTreeItemColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
ActivePaneBorderColor: lipgloss.AdaptiveColor{Dark: colors.defaultPink, Light: colors.defaultPink},
InactivePaneBorderColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
SpinnerColor: lipgloss.AdaptiveColor{Dark: colors.defaultPink, Light: colors.defaultPink},
StatusBarSelectedFileForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarSelectedFileBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.defaultPink, Light: colors.defaultPink},
StatusBarBarForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarBarBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.darkGray, Light: colors.darkGray},
StatusBarTotalFilesForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarTotalFilesBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.defaultLightPurple, Light: colors.defaultLightPurple},
StatusBarLogoForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarLogoBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.defaultDarkPurple, Light: colors.defaultDarkPurple},
ErrorColor: lipgloss.AdaptiveColor{Dark: colors.red, Light: colors.red},
DefaultTextColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
},
"gruvbox": {
SelectedTreeItemColor: lipgloss.AdaptiveColor{Dark: colors.gruvOrange, Light: colors.gruvOrange},
UnselectedTreeItemColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
ActivePaneBorderColor: lipgloss.AdaptiveColor{Dark: colors.gruvGreen, Light: colors.gruvGreen},
InactivePaneBorderColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
SpinnerColor: lipgloss.AdaptiveColor{Dark: colors.red, Light: colors.red},
StatusBarSelectedFileForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarSelectedFileBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.red, Light: colors.red},
StatusBarBarForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarBarBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.darkGray, Light: colors.darkGray},
StatusBarTotalFilesForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarTotalFilesBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.gruvYellow, Light: colors.gruvYellow},
StatusBarLogoForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarLogoBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.gruvBlue, Light: colors.gruvBlue},
ErrorColor: lipgloss.AdaptiveColor{Dark: colors.red, Light: colors.red},
DefaultTextColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
},
"spooky": {
SelectedTreeItemColor: lipgloss.AdaptiveColor{Dark: colors.spookyOrange, Light: colors.spookyOrange},
UnselectedTreeItemColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
ActivePaneBorderColor: lipgloss.AdaptiveColor{Dark: colors.spookyOrange, Light: colors.spookyOrange},
InactivePaneBorderColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
SpinnerColor: lipgloss.AdaptiveColor{Dark: colors.red, Light: colors.red},
StatusBarSelectedFileForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarSelectedFileBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.spookyPurple, Light: colors.spookyPurple},
StatusBarBarForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarBarBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.black, Light: colors.black},
StatusBarTotalFilesForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarTotalFilesBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.spookyYellow, Light: colors.spookyYellow},
StatusBarLogoForegroundColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.white},
StatusBarLogoBackgroundColor: lipgloss.AdaptiveColor{Dark: colors.spookyOrange, Light: colors.spookyOrange},
ErrorColor: lipgloss.AdaptiveColor{Dark: colors.red, Light: colors.red},
DefaultTextColor: lipgloss.AdaptiveColor{Dark: colors.white, Light: colors.black},
},
}

func GetCurrentTheme(theme string) Theme {
switch theme {
case "default":
return defaultTheme
return themeMap["default"]
case "gruvbox":
return gruvboxTheme
return themeMap["gruvbox"]
case "spooky":
return spookyTheme
return themeMap["spooky"]
default:
return defaultTheme
return themeMap["default"]
}
}

0 comments on commit 516bd18

Please sign in to comment.