theme.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package fyne
  2. import "image/color"
  3. // ThemeVariant indicates a variation of a theme, such as light or dark.
  4. //
  5. // Since: 2.0
  6. type ThemeVariant uint
  7. // ThemeColorName is used to look up a colour based on its name.
  8. //
  9. // Since: 2.0
  10. type ThemeColorName string
  11. // ThemeIconName is used to look up an icon based on its name.
  12. //
  13. // Since: 2.0
  14. type ThemeIconName string
  15. // ThemeSizeName is used to look up a size based on its name.
  16. //
  17. // Since: 2.0
  18. type ThemeSizeName string
  19. // Theme defines the method to look up colors, sizes and fonts that make up a Fyne theme.
  20. //
  21. // Since: 2.0
  22. type Theme interface {
  23. Color(ThemeColorName, ThemeVariant) color.Color
  24. Font(TextStyle) Resource
  25. Icon(ThemeIconName) Resource
  26. Size(ThemeSizeName) float32
  27. }
  28. // LegacyTheme defines the requirements of any Fyne theme.
  29. // This was previously called Theme and is kept for simpler transition of applications built before v2.0.0.
  30. //
  31. // Since: 2.0
  32. type LegacyTheme interface {
  33. BackgroundColor() color.Color
  34. ButtonColor() color.Color
  35. DisabledButtonColor() color.Color
  36. TextColor() color.Color
  37. DisabledTextColor() color.Color
  38. PlaceHolderColor() color.Color
  39. PrimaryColor() color.Color
  40. HoverColor() color.Color
  41. FocusColor() color.Color
  42. ScrollBarColor() color.Color
  43. ShadowColor() color.Color
  44. TextSize() int
  45. TextFont() Resource
  46. TextBoldFont() Resource
  47. TextItalicFont() Resource
  48. TextBoldItalicFont() Resource
  49. TextMonospaceFont() Resource
  50. Padding() int
  51. IconInlineSize() int
  52. ScrollBarSize() int
  53. ScrollBarSmallSize() int
  54. }