testtheme.go 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package test
  2. import (
  3. "image/color"
  4. "fyne.io/fyne/v2"
  5. "fyne.io/fyne/v2/theme"
  6. )
  7. var (
  8. red = &color.RGBA{R: 200, G: 0, B: 0, A: 255}
  9. green = &color.RGBA{R: 0, G: 255, B: 0, A: 255}
  10. blue = &color.RGBA{R: 0, G: 0, B: 255, A: 255}
  11. )
  12. // NewTheme returns a new testTheme.
  13. func NewTheme() fyne.Theme {
  14. return &configurableTheme{
  15. colors: map[fyne.ThemeColorName]color.Color{
  16. theme.ColorNameBackground: red,
  17. theme.ColorNameButton: color.Black,
  18. theme.ColorNameDisabled: color.Black,
  19. theme.ColorNameDisabledButton: color.White,
  20. theme.ColorNameError: blue,
  21. theme.ColorNameFocus: color.RGBA{red.R, red.G, red.B, 66},
  22. theme.ColorNameForeground: color.White,
  23. theme.ColorNameHover: green,
  24. theme.ColorNameHeaderBackground: color.RGBA{red.R, red.G, red.B, 22},
  25. theme.ColorNameInputBackground: color.RGBA{red.R, red.G, red.B, 30},
  26. theme.ColorNameInputBorder: color.Black,
  27. theme.ColorNameMenuBackground: color.RGBA{red.R, red.G, red.B, 30},
  28. theme.ColorNameOverlayBackground: color.RGBA{red.R, red.G, red.B, 44},
  29. theme.ColorNamePlaceHolder: blue,
  30. theme.ColorNamePressed: blue,
  31. theme.ColorNamePrimary: green,
  32. theme.ColorNameScrollBar: blue,
  33. theme.ColorNameSeparator: color.Black,
  34. theme.ColorNameSelection: color.RGBA{red.R, red.G, red.B, 44},
  35. theme.ColorNameShadow: blue,
  36. },
  37. fonts: map[fyne.TextStyle]fyne.Resource{
  38. {}: theme.DefaultTextBoldFont(),
  39. {Bold: true}: theme.DefaultTextItalicFont(),
  40. {Bold: true, Italic: true}: theme.DefaultTextMonospaceFont(),
  41. {Italic: true}: theme.DefaultTextBoldItalicFont(),
  42. {Monospace: true}: theme.DefaultTextFont(),
  43. },
  44. sizes: map[fyne.ThemeSizeName]float32{
  45. theme.SizeNameInlineIcon: float32(24),
  46. theme.SizeNameInnerPadding: float32(20),
  47. theme.SizeNameLineSpacing: float32(6),
  48. theme.SizeNamePadding: float32(10),
  49. theme.SizeNameScrollBar: float32(10),
  50. theme.SizeNameScrollBarSmall: float32(2),
  51. theme.SizeNameSeparatorThickness: float32(1),
  52. theme.SizeNameText: float32(18),
  53. theme.SizeNameHeadingText: float32(30.6),
  54. theme.SizeNameSubHeadingText: float32(24),
  55. theme.SizeNameCaptionText: float32(15),
  56. theme.SizeNameInputBorder: float32(5),
  57. theme.SizeNameInputRadius: float32(2),
  58. theme.SizeNameSelectionRadius: float32(6),
  59. },
  60. }
  61. }