Reddit Colored Comments [Updated for RES Users]

Customizable Colored Comments for Reddit. [Updated for RES Users 2025]

目前为 2025-01-25 提交的版本。查看 最新版本

  1. /* ==UserStyle==
  2. @name Reddit Colored Comments [Updated for RES Users]
  3. @namespace typpi.online
  4. @description Customizable Colored Comments for Reddit. [Updated for RES Users 2025]
  5. @author vednoc [Updated by Nick2bad4u]
  6. @version 1.6.3
  7. @license MIT
  8. @homepageURL https://github.com/Nick2bad4u/UserStyles
  9. @supportURL https://github.com/Nick2bad4u/UserStyles/issues
  10. @supportURL https://github.com/Nick2bad4u/UserStyles/issues
  11. @preprocessor stylus
  12.  
  13. ------------------------------------------------
  14. New Reddit Options
  15. ------------------------------------------------
  16. @var range lineWidth '● New Design - Line Width' [4, 1, 25, 1]
  17. @var checkbox lineStyle '⠀⠀⚬ Line Color Style: Full or Partial' 0
  18. @var checkbox hideLines '⠀⠀⚬ Hide previous lines' 0
  19.  
  20. ------------------------------------------------
  21. Old Reddit Options
  22. ------------------------------------------------
  23. @var range oldLineWidth '● Old Design - Line Width' [4, 1, 25, 1]
  24. @var checkbox oldLineStyle '⠀⠀Line Style: Solid or Dotted' 0
  25.  
  26. ------------------------------------------------
  27. Old Reddit - Minimize Button Area
  28. ------------------------------------------------
  29. @var checkbox oldMinimizeArea '● Old Design - Color the Minimize Button Area' 0
  30. @var color oldMinimizeColor '⠀⠀⚬ Color of the Minimize Button Area' #00000080
  31. @var checkbox oldMinimizeRainbow '⠀⠀⚬ Rainbow Color the Minimize Button Area' 0
  32.  
  33. ------------------------------------------------
  34. Old Reddit - Minimize Button Area Hover
  35. ------------------------------------------------
  36. @var checkbox oldHoverArea '● Old Design - Color the Minimize Button Area Hover' 0
  37. @var color oldHoverColor '⠀⠀⚬ Color of the Minimize Button Area Hover' #00000080
  38. @var checkbox oldHoverRainbow '⠀⠀⚬ Rainbow Color the Minimize Button Area Hover' 0
  39.  
  40. ------------------------------------------------
  41. New Reddit and Old Reddit - Comment Depth Colors
  42. ------------------------------------------------
  43. @var color color1 '>>> Old + New - Comment Depth 1 - Color' #f07178
  44. @var color color2 '>>> Old + New - Comment Depth 2 - Color' #f78c6c
  45. @var color color3 '>>> Old + New - Comment Depth 3 - Color' #ffcb6b
  46. @var color color4 '>>> Old + New - Comment Depth 4 - Color' #f3ff89
  47. @var color color5 '>>> Old + New - Comment Depth 5 - Color' #c3e88d
  48. @var color color6 '>>> Old + New - Comment Depth 6 - Color' #8de89e
  49. @var color color7 '>>> Old + New - Comment Depth 7 - Color' #89ddff
  50. @var color color8 '>>> Old + New - Comment Depth 8 - Color' #82aaff
  51. @var color color9 '>>> Old + New - Comment Depth 9 - Color' #c792ea
  52. @var color color10 '>>> Old + New - Comment Depth 10 - Color' #9a91ea
  53. @var color color11 '>>> Old + New - Comment Depth 11 - Color' #f8b0b7
  54. @var color color12 '>>> Old + New - Comment Depth 12 - Color' #fbc7c3
  55. @var color color13 '>>> Old + New - Comment Depth 13 - Color' #ffd6a9
  56. @var color color14 '>>> Old + New - Comment Depth 14 - Color' #fdf8b2
  57. @var color color15 '>>> Old + New - Comment Depth 15 - Color' #d8f1b9
  58. @var color color16 '>>> Old + New - Comment Depth 16 - Color' #aeecc3
  59. @var color color17 '>>> Old + New - Comment Depth 17 - Color' #a5e2f9
  60. @var color color18 '>>> Old + New - Comment Depth 18 - Color' #a2bff8
  61. @var color color19 '>>> Old + New - Comment Depth 19 - Color' #ddbaf5
  62. @var color color20 '>>> Old + New - Comment Depth 20 - Color' #c4bcf5
  63.  
  64. ------------------------------------------------
  65. Original Style made by Vendoc
  66. ------------------------------------------------
  67. @var text originalstyle '● Original Style made by Vendoc' "'https://userstyles.world/style/4734/reddit-colored-comments'"
  68.  
  69. ==/UserStyle== */
  70. @-moz-document domain('reddit.com') {
  71. // Set line width for the new design
  72. if ( lineWidth != 2 ) {
  73. .threadline {
  74. border-right-width: s( '%spx', lineWidth ) !important;
  75. }
  76. }
  77.  
  78. // Set mode for line style in the new design
  79. $mode = '';
  80.  
  81. if ( lineStyle ) {
  82. $mode = '> div >';
  83. }
  84.  
  85. // Apply colors and styles to each level up to 20
  86. for $i in 1 .. 20 {
  87. div[id ^= 't'] > :first-child,
  88. div[id ^= 'moreComments'] > :first-child,
  89. div[id ^= 'continueThread'] > :first-child {
  90. // Create a string for the nth-child selector
  91. $nth = s( '%s', $i );
  92.  
  93. > :nth-child({$nth}) {
  94. $mode;
  95. }
  96.  
  97. .threadline {
  98. border-right-color: color + $i !important;
  99. }
  100.  
  101. // Hide previous lines if the option is checked
  102. if ( hideLines ) {
  103. > :nth-child({$nth}) > .threadline {
  104. border-right-color: #0000 !important;
  105. }
  106. }
  107. }
  108. }
  109.  
  110. // Old design specific styles
  111. .comment .child,
  112. .comment .showreplies,
  113. .res-commentBoxes.res-continuity .comment div.child {
  114. // Set line width for the old design
  115. if ( oldLineWidth != 1 ) {
  116. border-left-width: s( '%spx', oldLineWidth ) !important;
  117. }
  118.  
  119. // Set line style for the old design
  120. if ( oldLineStyle == 0 ) {
  121. border-left-style: solid !important;
  122. }
  123. else {
  124. border-left-style: dotted !important;
  125. }
  126. }
  127.  
  128. // Apply colors to nested child elements
  129. $str = '.res-commentBoxes.res-continuity .comment div.child ';
  130.  
  131. for $i in 1 .. 20 {
  132. {$str} {
  133. border-left-color: color + $i !important;
  134. }
  135.  
  136. // Increase the nesting level for each iteration
  137. $str += '> .sitetable > .comment > .child ';
  138. }
  139.  
  140. // Toggle coloring of the area
  141. if ( oldMinimizeRainbow == 1 ) {
  142. // Apply color to .expand elements within nested child elements
  143. $str2 = '.res-commentBoxes.res-continuity .comment div.child ';
  144.  
  145. for $i in 1 .. 20 {
  146. {$str2} .expand {
  147. background-color: color + $i !important;
  148. }
  149.  
  150. // Increase the nesting level for each iteration
  151. $str2 += '> .sitetable > .comment > .child ';
  152. }
  153. }
  154.  
  155. if ( oldHoverRainbow == 1 && oldMinimizeRainbow == 1 ) {
  156. // Apply hover effect to .expand elements within nested child elements
  157. $str5 = '.res-commentBoxes.res-continuity .comment div.child ';
  158.  
  159. for $i in 11 .. 20 {
  160. {$str5} .expand:hover {
  161. background-color: color + $i !important;
  162. }
  163.  
  164. // Increase the nesting level for each iteration
  165. $str5 += '> .sitetable > .comment > .child ';
  166. }
  167. }
  168.  
  169.  
  170. if ( oldHoverRainbow == 1 && oldMinimizeRainbow == 0 ) {
  171. // Apply hover effect to .expand elements within nested child elements
  172. $str5 = '.res-commentBoxes.res-continuity .comment div.child ';
  173.  
  174. for $i in 1 .. 20 {
  175. {$str5} .expand:hover {
  176. background-color: color + $i !important;
  177. }
  178.  
  179. // Increase the nesting level for each iteration
  180. $str5 += '> .sitetable > .comment > .child ';
  181. }
  182. }
  183.  
  184. if ( oldMinimizeArea == 1 ) {
  185. // Apply a background color to .expand elements in the tagline
  186. .commentarea .entry > .tagline > .expand {
  187. background-color: oldMinimizeColor !important;
  188. }
  189. }
  190.  
  191. if ( oldHoverArea == 1 ) {
  192. // Apply a background color to .expand elements in the tagline
  193. .commentarea .entry > .tagline > .expand:hover {
  194. background-color: oldHoverColor !important;
  195. }
  196. }
  197. }