_scales.scss 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. /************
  2. * GtkScale *
  3. ************/
  4. $scale_slider_bg: if($variant == 'light', $base_color, lighten($base_color, 10%));
  5. $scale_trough_bg: if($variant == 'light', transparentize(black,0.86), lighten(transparentize($bg_color,0.86), 47%));
  6. %scale_trough {
  7. background-color: $scale_trough_bg;
  8. border: none;
  9. border-radius: 3px;
  10. margin: 0;
  11. &:disabled { background-color: transparentize(black,0.86); }
  12. &:backdrop {
  13. background-color: transparentize(black,0.86);
  14. transition: $backdrop_transition;
  15. &:disabled { background-color: transparentize(black,0.86); }
  16. }
  17. }
  18. %scale_highlight {
  19. border: none;
  20. background-color: $selected_bg_color;
  21. border-radius: 3px;
  22. margin: 0;
  23. &:disabled {
  24. border: none;
  25. background-color: transparentize(black, 0.86);
  26. }
  27. &:backdrop,
  28. &:active:backdrop {
  29. border-color: lighten($selected_bg_color, 5%);
  30. background-color: lighten($selected_bg_color, 5%);
  31. &:disabled {
  32. background-color: transparentize(black, 0.9);
  33. }
  34. }
  35. }
  36. scale {
  37. // sizing
  38. $_marks_lenght: 6px;
  39. $_marks_distance: 6px;
  40. min-height: 16px;
  41. min-width: 16px;
  42. padding: 8px;
  43. &.horizontal {
  44. trough,
  45. progress { min-height: 6px; }
  46. }
  47. &.vertical {
  48. trough,
  49. progress { min-width: 6px; }
  50. }
  51. // the slider is inside the trough, so to have make it bigger there's a negative margin
  52. slider {
  53. min-height: 16px;
  54. min-width: 16px;
  55. margin: -7px;
  56. background-color: $scale_slider_bg;
  57. box-shadow: inset 0 1px $top_highlight,
  58. 0px 0px 1px 1px rgba(0,0,0,0.1);
  59. border-radius: 12px;
  60. transition: $button_transition;
  61. transition-property: background, border, box-shadow;
  62. &:active {
  63. background-color: $purple;
  64. &:disabled {
  65. background-color: $insensitive_bg_color;
  66. box-shadow: inset 0 1px $top_highlight,
  67. 0px 0px 1px 1px rgba(0,0,0,0.05);
  68. }
  69. }
  70. }
  71. // click-and-hold the slider to activate
  72. &.fine-tune {
  73. &.horizontal {
  74. padding-top: 9px;
  75. padding-bottom: 9px;
  76. min-height: 16px;
  77. }
  78. &.vertical {
  79. padding-left: 9px;
  80. padding-right: 9px;
  81. min-width: 16px;
  82. }
  83. // to make the trough grow in fine-tune mode
  84. slider { margin: -6px; }
  85. fill,
  86. highlight,
  87. trough {
  88. border-radius: 5px;
  89. -gtk-outline-radius: 7px;
  90. }
  91. }
  92. // the backing bit
  93. trough {
  94. @extend %scale_trough;
  95. outline-offset: 2px;
  96. -gtk-outline-radius: 5px;
  97. outline-color: transparent;
  98. }
  99. // the colored part of the backing bit
  100. highlight { @extend %scale_highlight; }
  101. // this is another differently styled part of the backing bit, the most relevant use case is for example
  102. // in media player to indicate how much video stream as been cached
  103. fill {
  104. @extend %scale_trough;
  105. &:backdrop, & { background-color: $borders_color; }
  106. &:disabled {
  107. &:backdrop, & {
  108. border-color: transparent;
  109. background-color: transparent;
  110. }
  111. }
  112. // OSD
  113. .osd & {
  114. background-color: mix($osd_fg_color, $osd_borders_color, 25%);
  115. &:disabled {
  116. &:backdrop, & {
  117. border-color: transparent;
  118. background-color: transparent;
  119. }
  120. }
  121. }
  122. }
  123. slider {
  124. border-color: $base_color;
  125. border: none;
  126. border-radius: 12px;
  127. background-color: $scale_slider_bg;
  128. box-shadow: inset 0 1px $top_highlight,
  129. 0px 0px 1px 1px rgba(0,0,0,0.1);
  130. &:hover { @include button(hover-alt, $edge: $shadow_color); }
  131. &:active { border-color: $selected_borders_color; }
  132. &:disabled {
  133. background-color: $insensitive_bg_color;
  134. box-shadow: inset 0 1px $top_highlight,
  135. 0px 0px 1px 1px rgba(0,0,0,0.1);
  136. }
  137. &:backdrop,
  138. &:backdrop:disabled {
  139. transition: $backdrop_transition;
  140. background-color: $insensitive_bg_color;
  141. box-shadow: inset 0 1px $top_highlight,
  142. 0px 0px 1px 1px rgba(0,0,0,0.1);
  143. }
  144. // ...on selected list rows
  145. row:selected & { &:disabled, & { border-color: $selected_borders_color; } }
  146. // OSD
  147. .osd & {
  148. @include button(osd);
  149. border-color: darken($osd_borders_color, 3%);
  150. background-color: opacify($osd_bg_color, 1); // solid background needed here
  151. &:hover {
  152. @include button(osd-hover);
  153. background-color: opacify($osd_bg_color, 1); // solid background needed here
  154. }
  155. &:active {
  156. @include button(osd-active);
  157. background-color: opacify($osd_bg_color, 1); // solid background needed here
  158. }
  159. &:disabled {
  160. @include button(osd-insensitive);
  161. background-color: opacify($osd_bg_color, 1); // solid background needed here
  162. }
  163. &:backdrop {
  164. @include button(osd-backdrop);
  165. background-color: opacify($osd_bg_color, 1); // solid background needed here
  166. &:disabled {
  167. @include button(osd-backdrop-insensitive);
  168. background-color: opacify($osd_bg_color, 1); // solid background needed here
  169. }
  170. }
  171. }
  172. }
  173. value { color: gtkalpha(currentColor, 0.4); }
  174. marks {
  175. color: gtkalpha(currentColor, 0.4);
  176. @each $marks_class, $marks_pos, $marks_margin in (top, top, bottom),
  177. (bottom, bottom, top),
  178. (top, left, right),
  179. (bottom, right, left) {
  180. &.#{$marks_class} {
  181. margin-#{$marks_margin}: $_marks_distance;
  182. margin-#{$marks_pos}: -($_marks_distance + $_marks_lenght);
  183. }
  184. }
  185. }
  186. &.fine-tune marks {
  187. @each $marks_class, $marks_pos, $marks_margin in (top, top, bottom),
  188. (bottom, bottom, top),
  189. (top, left, right),
  190. (bottom, right, left) {
  191. &.#{$marks_class} {
  192. margin-#{$marks_margin}: $_marks_distance;
  193. margin-#{$marks_pos}: -($_marks_distance + $_marks_lenght - 3px);
  194. }
  195. }
  196. }
  197. &.horizontal {
  198. indicator {
  199. min-height: $_marks_lenght;
  200. min-width: 1px;
  201. }
  202. &.fine-tune indicator { min-height: ($_marks_lenght - 3px); }
  203. }
  204. &.vertical {
  205. indicator {
  206. min-height: 1px;
  207. min-width: $_marks_lenght;
  208. }
  209. &.fine-tune indicator { min-width: ($_marks_lenght - 3px); }
  210. }
  211. // *WARNING* scale with marks madness following
  212. // FIXME: OSD and selected list rows missing, I don't feel like adding the other 144 assets needed for those...
  213. $suffix: if($variant == 'light', '', '-dark');
  214. @each $dir_class, $dir_infix in ('horizontal', 'horz'),
  215. ('vertical', 'vert') {
  216. @each $marks_infix, $marks_class in ('scale-has-marks-above', 'marks-before:not(.marks-after)'),
  217. ('scale-has-marks-below', 'marks-after:not(.marks-before)') {
  218. @each $state, $state_infix in ('', ''),
  219. (':hover', '-hover'),
  220. (':active', '-active'),
  221. (':disabled', '-insensitive'),
  222. (':backdrop', '-backdrop'),
  223. (':backdrop:disabled', '-backdrop-insensitive') {
  224. &.#{$dir_class}.#{$marks_class} {
  225. slider {
  226. &#{$state} {
  227. // an asymmetric slider asset is used here, so the margins are uneven, the smaller
  228. // margin is set on the point side.
  229. min-height: 16px;
  230. min-width: 16px;
  231. margin: -7px;
  232. border: none;
  233. border-radius: 50%;
  234. background-color: $scale_slider_bg;
  235. box-shadow: inset 0 1px $top_highlight,
  236. 0px 0px 1px 1px rgba(0,0,0,0.1);
  237. }
  238. }
  239. &.fine-tune slider {
  240. // bigger negative margins to make the trough grow here as well
  241. margin: -7px;
  242. }
  243. }
  244. }
  245. }
  246. }
  247. &.color {
  248. min-height: 0;
  249. min-width: 0;
  250. trough {
  251. background-image: image($borders_color);
  252. background-repeat: no-repeat;
  253. }
  254. &.horizontal {
  255. padding: 0 0 15px 0;
  256. trough {
  257. padding-bottom: 4px;
  258. background-position: 0 -3px;
  259. border-top-left-radius: 0;
  260. border-top-right-radius: 0;
  261. }
  262. slider {
  263. &:dir(ltr), &:dir(rtl) { // specificity bumb
  264. &:hover, &:backdrop, &:disabled, &:backdrop:disabled, & {
  265. margin-bottom: -15px;
  266. margin-top: 6px;
  267. }
  268. }
  269. }
  270. }
  271. &.vertical {
  272. &:dir(ltr) {
  273. padding: 0 0 0 15px;
  274. trough {
  275. padding-left: 4px;
  276. background-position: 3px 0;
  277. border-bottom-right-radius: 0;
  278. border-top-right-radius: 0;
  279. }
  280. slider {
  281. &:hover, &:backdrop, &:disabled, &:backdrop:disabled, & {
  282. margin-left: -15px;
  283. margin-right: 6px;
  284. }
  285. }
  286. }
  287. &:dir(rtl) {
  288. padding: 0 15px 0 0;
  289. trough {
  290. padding-right: 4px;
  291. background-position: -3px 0;
  292. border-bottom-left-radius: 0;
  293. border-top-left-radius: 0;
  294. }
  295. slider {
  296. &:hover, &:backdrop, &:disabled, &:backdrop:disabled, & {
  297. margin-right: -15px;
  298. margin-left: 6px;
  299. }
  300. }
  301. }
  302. }
  303. &.fine-tune {
  304. &.horizontal {
  305. &:dir(ltr), &:dir(rtl) { // specificity bump
  306. padding: 0 0 12px 0;
  307. trough {
  308. padding-bottom: 7px;
  309. background-position: 0 -6px;
  310. }
  311. slider {
  312. margin-bottom: -15px;
  313. margin-top: 6px;
  314. }
  315. }
  316. }
  317. &.vertical {
  318. &:dir(ltr) {
  319. padding: 0 0 0 12px;
  320. trough {
  321. padding-left: 7px;
  322. background-position: 6px 0;
  323. }
  324. slider {
  325. margin-left: -15px;
  326. margin-right: 6px;
  327. }
  328. }
  329. &:dir(rtl) {
  330. padding: 0 12px 0 0;
  331. trough {
  332. padding-right: 7px;
  333. background-position: -6px 0;
  334. }
  335. slider {
  336. margin-right: -15px;
  337. margin-left: 6px;
  338. }
  339. }
  340. }
  341. }
  342. }
  343. }