_scales.scss 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  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. }
  90. }
  91. // the backing bit
  92. trough {
  93. @extend %scale_trough;
  94. outline-offset: 2px;
  95. outline-color: transparent;
  96. }
  97. // the colored part of the backing bit
  98. highlight { @extend %scale_highlight; }
  99. // this is another differently styled part of the backing bit, the most relevant use case is for example
  100. // in media player to indicate how much video stream as been cached
  101. fill {
  102. @extend %scale_trough;
  103. &:backdrop, & { background-color: $borders_color; }
  104. &:disabled {
  105. &:backdrop, & {
  106. border-color: transparent;
  107. background-color: transparent;
  108. }
  109. }
  110. // OSD
  111. .osd & {
  112. background-color: mix($osd_fg_color, $osd_borders_color, 25%);
  113. &:disabled {
  114. &:backdrop, & {
  115. border-color: transparent;
  116. background-color: transparent;
  117. }
  118. }
  119. }
  120. }
  121. slider {
  122. border-color: $base_color;
  123. border: none;
  124. border-radius: 12px;
  125. background-color: $scale_slider_bg;
  126. box-shadow: inset 0 1px $top_highlight,
  127. 0px 0px 1px 1px rgba(0,0,0,0.1);
  128. &:hover { @include button(hover-alt, $edge: $shadow_color); }
  129. &:active { border-color: $selected_borders_color; }
  130. &:disabled {
  131. background-color: $insensitive_bg_color;
  132. box-shadow: inset 0 1px $top_highlight,
  133. 0px 0px 1px 1px rgba(0,0,0,0.1);
  134. }
  135. &:backdrop,
  136. &:backdrop:disabled {
  137. transition: $backdrop_transition;
  138. background-color: $insensitive_bg_color;
  139. box-shadow: inset 0 1px $top_highlight,
  140. 0px 0px 1px 1px rgba(0,0,0,0.1);
  141. }
  142. // ...on selected list rows
  143. row:selected & { &:disabled, & { border-color: $selected_borders_color; } }
  144. // OSD
  145. .osd & {
  146. @include button(osd);
  147. border-color: darken($osd_borders_color, 3%);
  148. background-color: opacify($osd_bg_color, 1); // solid background needed here
  149. &:hover {
  150. @include button(osd-hover);
  151. background-color: opacify($osd_bg_color, 1); // solid background needed here
  152. }
  153. &:active {
  154. @include button(osd-active);
  155. background-color: opacify($osd_bg_color, 1); // solid background needed here
  156. }
  157. &:disabled {
  158. @include button(osd-insensitive);
  159. background-color: opacify($osd_bg_color, 1); // solid background needed here
  160. }
  161. &:backdrop {
  162. @include button(osd-backdrop);
  163. background-color: opacify($osd_bg_color, 1); // solid background needed here
  164. &:disabled {
  165. @include button(osd-backdrop-insensitive);
  166. background-color: opacify($osd_bg_color, 1); // solid background needed here
  167. }
  168. }
  169. }
  170. }
  171. value { color: gtkalpha(currentColor, 0.4); }
  172. marks {
  173. color: gtkalpha(currentColor, 0.4);
  174. @each $marks_class, $marks_pos, $marks_margin in (top, top, bottom),
  175. (bottom, bottom, top),
  176. (top, left, right),
  177. (bottom, right, left) {
  178. &.#{$marks_class} {
  179. margin-#{$marks_margin}: $_marks_distance;
  180. margin-#{$marks_pos}: -($_marks_distance + $_marks_lenght);
  181. }
  182. }
  183. }
  184. &.fine-tune marks {
  185. @each $marks_class, $marks_pos, $marks_margin in (top, top, bottom),
  186. (bottom, bottom, top),
  187. (top, left, right),
  188. (bottom, right, left) {
  189. &.#{$marks_class} {
  190. margin-#{$marks_margin}: $_marks_distance;
  191. margin-#{$marks_pos}: -($_marks_distance + $_marks_lenght - 3px);
  192. }
  193. }
  194. }
  195. &.horizontal {
  196. indicator {
  197. min-height: $_marks_lenght;
  198. min-width: 1px;
  199. }
  200. &.fine-tune indicator { min-height: ($_marks_lenght - 3px); }
  201. }
  202. &.vertical {
  203. indicator {
  204. min-height: 1px;
  205. min-width: $_marks_lenght;
  206. }
  207. &.fine-tune indicator { min-width: ($_marks_lenght - 3px); }
  208. }
  209. // *WARNING* scale with marks madness following
  210. // FIXME: OSD and selected list rows missing, I don't feel like adding the other 144 assets needed for those...
  211. $suffix: if($variant == 'light', '', '-dark');
  212. @each $dir_class, $dir_infix in ('horizontal', 'horz'),
  213. ('vertical', 'vert') {
  214. @each $marks_infix, $marks_class in ('scale-has-marks-above', 'marks-before:not(.marks-after)'),
  215. ('scale-has-marks-below', 'marks-after:not(.marks-before)') {
  216. @each $state, $state_infix in ('', ''),
  217. (':hover', '-hover'),
  218. (':active', '-active'),
  219. (':disabled', '-insensitive'),
  220. (':backdrop', '-backdrop'),
  221. (':backdrop:disabled', '-backdrop-insensitive') {
  222. &.#{$dir_class}.#{$marks_class} {
  223. slider {
  224. &#{$state} {
  225. // an asymmetric slider asset is used here, so the margins are uneven, the smaller
  226. // margin is set on the point side.
  227. min-height: 16px;
  228. min-width: 16px;
  229. margin: -7px;
  230. border: none;
  231. border-radius: 50%;
  232. background-color: $scale_slider_bg;
  233. box-shadow: inset 0 1px $top_highlight,
  234. 0px 0px 1px 1px rgba(0,0,0,0.1);
  235. }
  236. }
  237. &.fine-tune slider {
  238. // bigger negative margins to make the trough grow here as well
  239. margin: -7px;
  240. }
  241. }
  242. }
  243. }
  244. }
  245. &.color {
  246. min-height: 0;
  247. min-width: 0;
  248. trough {
  249. background-image: image($borders_color);
  250. background-repeat: no-repeat;
  251. }
  252. &.horizontal {
  253. padding: 0 0 15px 0;
  254. trough {
  255. padding-bottom: 4px;
  256. background-position: 0 -3px;
  257. border-top-left-radius: 0;
  258. border-top-right-radius: 0;
  259. }
  260. slider {
  261. &:dir(ltr), &:dir(rtl) { // specificity bumb
  262. &:hover, &:backdrop, &:disabled, &:backdrop:disabled, & {
  263. margin-bottom: -15px;
  264. margin-top: 6px;
  265. }
  266. }
  267. }
  268. }
  269. &.vertical {
  270. &:dir(ltr) {
  271. padding: 0 0 0 15px;
  272. trough {
  273. padding-left: 4px;
  274. background-position: 3px 0;
  275. border-bottom-right-radius: 0;
  276. border-top-right-radius: 0;
  277. }
  278. slider {
  279. &:hover, &:backdrop, &:disabled, &:backdrop:disabled, & {
  280. margin-left: -15px;
  281. margin-right: 6px;
  282. }
  283. }
  284. }
  285. &:dir(rtl) {
  286. padding: 0 15px 0 0;
  287. trough {
  288. padding-right: 4px;
  289. background-position: -3px 0;
  290. border-bottom-left-radius: 0;
  291. border-top-left-radius: 0;
  292. }
  293. slider {
  294. &:hover, &:backdrop, &:disabled, &:backdrop:disabled, & {
  295. margin-right: -15px;
  296. margin-left: 6px;
  297. }
  298. }
  299. }
  300. }
  301. &.fine-tune {
  302. &.horizontal {
  303. &:dir(ltr), &:dir(rtl) { // specificity bump
  304. padding: 0 0 12px 0;
  305. trough {
  306. padding-bottom: 7px;
  307. background-position: 0 -6px;
  308. }
  309. slider {
  310. margin-bottom: -15px;
  311. margin-top: 6px;
  312. }
  313. }
  314. }
  315. &.vertical {
  316. &:dir(ltr) {
  317. padding: 0 0 0 12px;
  318. trough {
  319. padding-left: 7px;
  320. background-position: 6px 0;
  321. }
  322. slider {
  323. margin-left: -15px;
  324. margin-right: 6px;
  325. }
  326. }
  327. &:dir(rtl) {
  328. padding: 0 12px 0 0;
  329. trough {
  330. padding-right: 7px;
  331. background-position: -6px 0;
  332. }
  333. slider {
  334. margin-right: -15px;
  335. margin-left: 6px;
  336. }
  337. }
  338. }
  339. }
  340. }
  341. }