Reddit Colored Comments [Updated for RES Users]

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

目前为 2025-01-21 提交的版本,查看 最新版本

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