defaults.tcl 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. #
  2. # Settings for default theme.
  3. #
  4. namespace eval ttk::theme::default {
  5. variable colors
  6. array set colors {
  7. -frame "#d9d9d9"
  8. -foreground "#000000"
  9. -window "#ffffff"
  10. -text "#000000"
  11. -activebg "#ececec"
  12. -selectbg "#4a6984"
  13. -selectfg "#ffffff"
  14. -darker "#c3c3c3"
  15. -disabledfg "#a3a3a3"
  16. -indicator "#4a6984"
  17. -disabledindicator "#a3a3a3"
  18. -altindicator "#9fbdd8"
  19. -disabledaltindicator "#c0c0c0"
  20. }
  21. ttk::style theme settings default {
  22. ttk::style configure "." \
  23. -borderwidth 1 \
  24. -background $colors(-frame) \
  25. -foreground $colors(-foreground) \
  26. -troughcolor $colors(-darker) \
  27. -font TkDefaultFont \
  28. -selectborderwidth 1 \
  29. -selectbackground $colors(-selectbg) \
  30. -selectforeground $colors(-selectfg) \
  31. -insertwidth 1 \
  32. -indicatordiameter 10 \
  33. ;
  34. ttk::style map "." -background \
  35. [list disabled $colors(-frame) active $colors(-activebg)]
  36. ttk::style map "." -foreground \
  37. [list disabled $colors(-disabledfg)]
  38. ttk::style configure TButton \
  39. -anchor center -padding "3 3" -width -9 \
  40. -relief raised -shiftrelief 1
  41. ttk::style map TButton -relief [list {!disabled pressed} sunken]
  42. ttk::style configure TCheckbutton \
  43. -indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1
  44. ttk::style map TCheckbutton -indicatorcolor \
  45. [list pressed $colors(-activebg) \
  46. {!disabled alternate} $colors(-altindicator) \
  47. {disabled alternate} $colors(-disabledaltindicator) \
  48. {!disabled selected} $colors(-indicator) \
  49. {disabled selected} $colors(-disabledindicator)]
  50. ttk::style map TCheckbutton -indicatorrelief \
  51. [list alternate raised]
  52. ttk::style configure TRadiobutton \
  53. -indicatorcolor "#ffffff" -indicatorrelief sunken -padding 1
  54. ttk::style map TRadiobutton -indicatorcolor \
  55. [list pressed $colors(-activebg) \
  56. {!disabled alternate} $colors(-altindicator) \
  57. {disabled alternate} $colors(-disabledaltindicator) \
  58. {!disabled selected} $colors(-indicator) \
  59. {disabled selected} $colors(-disabledindicator)]
  60. ttk::style map TRadiobutton -indicatorrelief \
  61. [list alternate raised]
  62. ttk::style configure TMenubutton \
  63. -relief raised -padding "10 3"
  64. ttk::style configure TEntry \
  65. -relief sunken -fieldbackground white -padding 1
  66. ttk::style map TEntry -fieldbackground \
  67. [list readonly $colors(-frame) disabled $colors(-frame)]
  68. ttk::style configure TCombobox -arrowsize 12 -padding 1
  69. ttk::style map TCombobox -fieldbackground \
  70. [list readonly $colors(-frame) disabled $colors(-frame)] \
  71. -arrowcolor [list disabled $colors(-disabledfg)]
  72. ttk::style configure TSpinbox -arrowsize 10 -padding {2 0 10 0}
  73. ttk::style map TSpinbox -fieldbackground \
  74. [list readonly $colors(-frame) disabled $colors(-frame)] \
  75. -arrowcolor [list disabled $colors(-disabledfg)]
  76. ttk::style configure TLabelframe \
  77. -relief groove -borderwidth 2
  78. ttk::style configure TScrollbar \
  79. -width 12 -arrowsize 12
  80. ttk::style map TScrollbar \
  81. -arrowcolor [list disabled $colors(-disabledfg)]
  82. ttk::style configure TScale \
  83. -sliderrelief raised
  84. ttk::style configure TProgressbar \
  85. -background $colors(-selectbg)
  86. ttk::style configure TNotebook.Tab \
  87. -padding {4 2} -background $colors(-darker)
  88. ttk::style map TNotebook.Tab \
  89. -background [list selected $colors(-frame)]
  90. # Treeview.
  91. #
  92. ttk::style configure Heading -font TkHeadingFont -relief raised
  93. ttk::style configure Treeview \
  94. -background $colors(-window) \
  95. -foreground $colors(-text) ;
  96. ttk::style map Treeview \
  97. -background [list disabled $colors(-frame)\
  98. selected $colors(-selectbg)] \
  99. -foreground [list disabled $colors(-disabledfg) \
  100. selected $colors(-selectfg)]
  101. # Combobox popdown frame
  102. ttk::style layout ComboboxPopdownFrame {
  103. ComboboxPopdownFrame.border -sticky nswe
  104. }
  105. ttk::style configure ComboboxPopdownFrame \
  106. -borderwidth 1 -relief solid
  107. #
  108. # Toolbar buttons:
  109. #
  110. ttk::style layout Toolbutton {
  111. Toolbutton.border -children {
  112. Toolbutton.padding -children {
  113. Toolbutton.label
  114. }
  115. }
  116. }
  117. ttk::style configure Toolbutton \
  118. -padding 2 -relief flat
  119. ttk::style map Toolbutton -relief \
  120. [list disabled flat selected sunken pressed sunken active raised]
  121. ttk::style map Toolbutton -background \
  122. [list pressed $colors(-darker) active $colors(-activebg)]
  123. }
  124. }