1
0

config.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package editor
  2. import (
  3. "github.com/creasty/defaults"
  4. "github.com/gdamore/tcell/v3"
  5. )
  6. type Config struct {
  7. StyleDefault tcell.Style
  8. Colors Colors
  9. Properties Properties
  10. }
  11. type Properties struct {
  12. GutterWidth int `default:"4"`
  13. TabSpaces bool `default:"false"`
  14. TabWidthSpaces int `default:"4"`
  15. }
  16. type Colors struct {
  17. MainBackground string `default:"#090603"`
  18. MainForeground string `default:"#dddddd"`
  19. LineNumberBackground string `default:"#090603"`
  20. LineNumberForeground string `default:"#dddddd"`
  21. CursorColor string `default:"#777777"`
  22. CursorColorWrite string `default:"#dddddd"`
  23. PaletteBarBackground string `default:"#3b3b3b"`
  24. PaletteBarForeground string `default:"#dddddd"`
  25. PaletteInputBackground string `default:"#090603"`
  26. PaletteInputForeground string `default:"#dddddd"`
  27. InfoMsgBackground string `default:"#090603"`
  28. InfoMsgForeground string `default:"#dddddd"`
  29. WarnMsgBackground string `default:"#090603"`
  30. WarnMsgForeground string `default:"#efc541"`
  31. ErrorMsgBackground string `default:"#090603"`
  32. ErrorMsgForeground string `default:"#ff5e56"`
  33. WorkspaceBackground string `default:"#3b3b3b"`
  34. WorkspaceForeground string `default:"#b9b9b9"`
  35. WorkspaceBackgroundActive string `default:"#3b3b3b"`
  36. WorkspaceForegroundActive string `default:"#dddddd"`
  37. TabBackground string `default:"#3b3b3b"`
  38. TabForeground string `default:"#b9b9b9"`
  39. TabBackgroundActive string `default:"#3b3b3b"`
  40. TabForegroundActive string `default:"#dddddd"`
  41. }
  42. func DefaultConfig() Config {
  43. config := Config{}
  44. if err := defaults.Set(&config); err != nil {
  45. panic(err)
  46. }
  47. config.StyleDefault = tcell.StyleDefault.Background(tcell.GetColor(config.Colors.MainBackground)).Foreground(tcell.GetColor(config.Colors.MainForeground))
  48. return config
  49. }