ssashag

curved tabs css

Jul 26th, 2025
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.79 KB | Source Code | 0 0
  1. /* Source file https://github.com/MrOtherGuy/firefox-csshacks/tree/master/chrome/curved_tabs.css made available under Mozilla Public License v. 2.0
  2. See the above repository for updates as well as full license text. */
  3.  
  4. /* Makes tabs more curvy
  5. * Set svg.context-properties.content.enabled to true in about:config,
  6. * otherwise the bottom corners will be black
  7. */
  8. #tabbrowser-tabs{
  9. --uc-tab-curve-size: 17px; /* 10px looks about like chromium - 17px looks close to Australis tabs */
  10. --uc-tabs-scrollbutton-border: 0px;
  11. --tab-block-margin:0px;
  12. --tab-min-height: 34px;
  13. --uc-tab-line-color: rgb(10, 132, 255); /* This is only used when the first optional section is enabled, see below */
  14. --uc-curve-stroke-opacity: 1; /* can be used to decrease curve border contrast */
  15. }
  16.  
  17. .tabbrowser-tab{
  18. padding-inline: 0px !important; /* By default, proton tabs have 2px + 2px = 4px space between them */
  19. overflow: visible !important;
  20. }
  21. .tabbrowser-tab:is([selected],[multiselected]){
  22. position: relative;
  23. z-index: 2;
  24. }
  25. .tab-background{
  26. overflow: hidden !important;
  27. outline: none !important;
  28. box-shadow: none !important;
  29. }
  30. .tab-context-line{
  31. order: 1;
  32. }
  33. #TabsToolbar{ --toolbarbutton-inner-padding: 6px !important; }
  34.  
  35. .titlebar-spacer[type="pre-tabs"],
  36. .tabbrowser-tab::after{ border: none !important; }
  37.  
  38. .tabbrowser-tab:hover > .tab-stack::before,
  39. .tabbrowser-tab:hover > .tab-stack::after,
  40. .tabbrowser-tab:is([selected],[multiselected]) > .tab-stack::before,
  41. .tabbrowser-tab:is([selected],[multiselected]) > .tab-stack::after{
  42. width: var(--uc-tab-curve-size);
  43. height: 100%;
  44. display: block;
  45. position: absolute;
  46. content: "";
  47. fill: color-mix(in srgb, currentColor 11%, transparent);
  48. -moz-context-properties: fill,stroke,stroke-opacity;
  49. left: calc(0px - var(--uc-tab-curve-size));
  50. background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4NCjxzdmcgc3Ryb2tlLXdpZHRoPSIxLjEiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCIgdmlld0JveD0iMCAwIDE3IDE2IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KICA8cGF0aCBkPSJNMCAxNyBMMCAxNiBBMTYgMTYgMCAwIDAgMTYgMCBMIDE4IDAgTCAxOCAxNyBaIiBmaWxsPSJjb250ZXh0LWZpbGwiPjwvcGF0aD4NCiAgPHBhdGggZD0iTTAgMTYgQTE2IDE2IDAgMCAwIDE2IDAiIHN0cm9rZT0iY29udGV4dC1zdHJva2UiIHN0cm9rZS1vcGFjaXR5PSJjb250ZXh0LXN0cm9rZS1vcGFjaXR5IiBmaWxsPSJ0cmFuc3BhcmVudCI+PC9wYXRoPg0KPC9zdmc+"),var(--lwt-header-image, none);
  51. background-size: var(--uc-tab-curve-size),0;
  52. background-repeat: no-repeat,no-repeat;
  53. background-position-y: bottom, bottom -1px;
  54. background-position-x: 0,0;
  55. transform: scaleY(var(--uc-tab-vertical-transform));
  56. stroke-opacity: var(--uc-curve-stroke-opacity);
  57. z-index:1;
  58. pointer-events: none;
  59. background-origin: border-box;
  60. }
  61.  
  62. :root[lwtheme-image] .tabbrowser-tab:is([selected],[multiselected]) > .tab-stack::before,
  63. :root[lwtheme-image] .tabbrowser-tab:is([selected],[multiselected]) > .tab-stack::after{
  64. background-attachment: scroll,fixed;
  65. background-size: var(--uc-tab-curve-size),auto;
  66. }
  67. :root[lwtheme-image] .tabbrowser-tab:is([selected],[multiselected]) > .tab-stack::after{
  68. background-position-y: bottom,calc(var(--tab-min-height) - 1px);
  69. }
  70.  
  71. .tabbrowser-tab:is([selected],[multiselected]) > .tab-stack::before,
  72. .tabbrowser-tab:is([selected],[multiselected]) > .tab-stack::after{
  73. fill: var(--tab-selected-bgcolor,var(--toolbar-bgcolor)) !important;
  74. stroke: var(--lwt-tabs-border-color,transparent);
  75. }
  76.  
  77. :root[lwtheme] .tabbrowser-tab:is([selected],[multiselected]) > .tab-stack::before,
  78. :root[lwtheme] .tabbrowser-tab:is([selected],[multiselected]) > .tab-stack::after{
  79. fill: var(--tab-selected-bgcolor,var(--toolbar-bgcolor)) !important;
  80. }
  81. .tabbrowser-tab:is([selected],[multiselected]) > .tab-stack::after,
  82. .tabbrowser-tab:hover > .tab-stack::after{
  83. left: auto;
  84. right: calc(0px - var(--uc-tab-curve-size));
  85. transform: scaleX(-1);
  86. }
  87.  
  88. .tabbrowser-tab:hover > stack > .tab-background,
  89. .tab-background:is([selected],[multiselected]){
  90. border-radius: var(--uc-tab-curve-size) var(--uc-tab-curve-size) 0 0 !important;
  91.  
  92. }
  93.  
  94. .tabbrowser-tab:first-child{
  95. margin-inline-start: var(--uc-tab-curve-size) !important;
  96. }
  97. #pinned-tabs-container{
  98. margin-inline-end: calc(0px - var(--uc-tab-curve-size)) !important;
  99. }
  100. #scrollbutton-up,
  101. #scrollbutton-down{ border-block-width: var(--uc-tabs-scrollbutton-border,0px) !important; }
  102. .tab-background:is([selected],[multiselected]){ border: 1px solid var(--lwt-tabs-border-color) !important; border-bottom: none !important }
  103.  
  104. .tab-context-line{
  105. margin-block: 0 !important;
  106. }
  107.  
  108. /* Annoying fix to prevent hovering of last tab to trigger tab overflow, better solution wanted */
  109. .tabbrowser-tab:last-of-type{ margin-inline-end: var(--uc-tab-curve-size) !important; }
  110.  
  111. /* To counter the above, make tabs toolbar spacer a bit narrower so there won't be too much space reserved when window dragging spacers are shown */
  112. .titlebar-spacer[type="pre-tabs"]{ width: 24px !important; }
  113.  
  114.  
  115. /* OPTIONAL - COLORS - show tabs border, selected tab line and make selected tab match the main toolbar color. Also disables tab shadow */
  116. /* Using these color options requires you to set layout.css.color-mix.enabled to true in about:config */
  117.  
  118. @media (-moz-bool-pref: "userchrome.curved_tabs.extra-border.enabled"),
  119. -moz-pref("userchrome.curved_tabs.extra-border.enabled"){
  120. #navigator-toolbox{ --lwt-tabs-border-color: color-mix(in srgb, currentcolor, white 50%) !important; }
  121. :root[lwtheme-brighttext] #navigator-toolbox{ --lwt-tabs-border-color: color-mix(in srgb, currentcolor, black 50%) !important; }
  122. #tabbrowser-tabs{ --lwt-selected-tab-background-color: var(--toolbar-bgcolor) }
  123. .tab-background:is([selected],[multiselected]){
  124. border-top: none !important;
  125. --toolbar-bgcolor: transparent;
  126. }
  127. :root:not([lwtheme]) .tab-background{
  128. background-color: var(--lwt-selected-tab-background-color) !important;
  129. }
  130. .tabbrowser-tab:is([selected],[multiselected]) > .tab-stack::before,
  131. .tabbrowser-tab:is([selected],[multiselected]) > .tab-stack::after{
  132. fill: var(--lwt-selected-tab-background-color,var(--toolbar-bgcolor)) !important;
  133. }
  134. .tabbrowser-tab:is([selected],[multiselected]) > .tab-stack::before{
  135. left: calc(1px - var(--uc-tab-curve-size));
  136. }
  137. .tabbrowser-tab:is([selected],[multiselected]):is([selected],[multiselected]) > .tab-stack::after{
  138. right: calc(1px - var(--uc-tab-curve-size));
  139. }
  140. .tab-background:is([selected],[multiselected])::before{
  141. content: "";
  142. display: flex;
  143. height: 2px;
  144. background: var(--uc-tab-line-color) !important;
  145. }
  146. #nav-bar{ box-shadow: 0 -1px 0 var(--lwt-tabs-border-color) }
  147. }
  148.  
  149. /* OPTIONAL - Make some of the buttons in tabs toolbar rounded, which might look nicer especially with large curve size */
  150. @media (-moz-bool-pref: "userchrome.curved_tabs.round-buttons.enabled"),
  151. -moz-pref("userchrome.curved_tabs.round-buttons.enabled"){
  152. #tabs-newtab-button > .toolbarbutton-icon,
  153. #TabsToolbar #new-tab-button > .toolbarbutton-icon,
  154. #alltabs-button > .toolbarbutton-badge-stack,
  155. .tab-close-button{ border-radius: 30px !important; }
  156. }
  157.  
  158. /* OPTIONAL - uncomment the following to flip the curves vertically - maybe useful for tabs on bottom ? */
  159. @media (-moz-bool-pref: "userchrome.curved_tabs.flipped-curve.enabled"),
  160. -moz-pref("userchrome.curved_tabs.flipped-curve.enabled"){
  161. .tab-background{ flex-direction: column-reverse }
  162. .tabbrowser-tab:hover > .tab-stack > .tab-background,
  163. .tab-background[selected]{ border-radius: 0 0 var(--uc-tab-curve-size) var(--uc-tab-curve-size) !important }
  164. .tabbrowser-tab > .tab-stack::before{ transform: scaleY(-1) !important; }
  165. .tabbrowser-tab > .tab-stack::after{ transform: scaleY(-1) scaleX(-1) !important; }
  166. }
  167.  
Add Comment
Please, Sign In to add comment