Discord Dark Background Modifier

Applies dark background to various Discord UI elements

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

  1. // ==UserScript==
  2. // @name Discord Dark Background Modifier
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.7
  5. // @description Applies dark background to various Discord UI elements
  6. // @author You
  7. // @match https://discord.com/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. const DARK_BACKGROUND = '#343339';
  16.  
  17. function applyDarkStyles() {
  18. // 1. Modify selected list items (original functionality)
  19. let listItems = document.querySelectorAll('.listItemWrapper__91816.selected__91816');
  20. listItems.forEach(listItem => {
  21. let wrapper = listItem.querySelector('.wrapper_cc5dd2');
  22. if (wrapper) {
  23. wrapper.querySelectorAll('*').forEach(child => {
  24. child.style.opacity = "0";
  25. });
  26. wrapper.style.backgroundImage = "url(https://i.imgur.com/FTckCa9.png)";
  27. wrapper.style.zIndex = "9999";
  28. wrapper.style.borderRadius = "10px";
  29. wrapper.style.backgroundSize = "contain";
  30. wrapper.style.backgroundRepeat = "no-repeat";
  31. wrapper.style.backgroundPosition = "center";
  32. }
  33. });
  34.  
  35. // 2. Modify members list background
  36. const membersList = document.querySelector('.members_c8ffbb.thin_d125d2.scrollerBase_d125d2.fade_d125d2');
  37. if (membersList) {
  38. membersList.style.background = DARK_BACKGROUND;
  39. }
  40.  
  41. // 3. Modify user area panel background
  42. const userPanel = document.querySelector('section.panels_c48ade[aria-label="User area"]');
  43. if (userPanel) {
  44. userPanel.style.background = DARK_BACKGROUND;
  45. }
  46.  
  47. // 4. Modify individual member items
  48. const memberItems = document.querySelectorAll('.member__5d473.container__91a9d.clickable__91a9d');
  49. memberItems.forEach(item => {
  50. item.style.background = DARK_BACKGROUND;
  51. const childContainer = item.querySelector('.childContainer__91a9d');
  52. if (childContainer) {
  53. childContainer.style.background = DARK_BACKGROUND;
  54. }
  55. });
  56.  
  57. // 5. Modify user panel container
  58. const userPanelContainer = document.querySelector('.container__37e49');
  59. if (userPanelContainer) {
  60. userPanelContainer.style.background = DARK_BACKGROUND;
  61. }
  62.  
  63. // 6. Modify server list container
  64. const serverListContainer = document.querySelector('.stack_dbd263.scroller_ef3116.none_d125d2.scrollerBase_d125d2');
  65. if (serverListContainer) {
  66. serverListContainer.style.background = DARK_BACKGROUND;
  67. }
  68.  
  69. // 7. Modify server list items
  70. const serverListItems = document.querySelectorAll('.listItem__650eb');
  71. serverListItems.forEach(item => {
  72. item.style.background = DARK_BACKGROUND;
  73. });
  74.  
  75. // 8. Modify server list wrappers
  76. const serverListWrappers = document.querySelectorAll('.wrapper_d144f8');
  77. serverListWrappers.forEach(wrapper => {
  78. wrapper.style.background = DARK_BACKGROUND;
  79. });
  80.  
  81. // 9. Modify private channels navigation
  82. const privateChannelsNav = document.querySelector('.privateChannels__35e86');
  83. if (privateChannelsNav) {
  84. privateChannelsNav.style.background = DARK_BACKGROUND;
  85. }
  86.  
  87. // 10. Modify private channels scroller
  88. const privateChannelsScroller = document.querySelector('.privateChannels__35e86 .scroller__99e7c');
  89. if (privateChannelsScroller) {
  90. privateChannelsScroller.style.background = DARK_BACKGROUND;
  91. }
  92.  
  93. // 11. Modify private channel items
  94. const privateChannelItems = document.querySelectorAll('.channel__972a0.container_e45859');
  95. privateChannelItems.forEach(item => {
  96. item.style.background = DARK_BACKGROUND;
  97. });
  98.  
  99. // 12. Modify friends button container
  100. const friendsButtonContainer = document.querySelector('.friendsButtonContainer__35e86');
  101. if (friendsButtonContainer) {
  102. friendsButtonContainer.style.background = DARK_BACKGROUND;
  103. }
  104.  
  105. // 13. Modify section dividers
  106. const sectionDividers = document.querySelectorAll('.sectionDivider__35e86');
  107. sectionDividers.forEach(divider => {
  108. divider.style.background = DARK_BACKGROUND;
  109. });
  110. }
  111.  
  112. // Wait for elements to exist
  113. function waitForElement(selector, callback) {
  114. const observer = new MutationObserver((mutations, obs) => {
  115. if (document.querySelector(selector)) {
  116. obs.disconnect();
  117. callback();
  118. }
  119. });
  120. observer.observe(document.body, { childList: true, subtree: true });
  121. }
  122.  
  123. // Observe changes in Discord UI
  124. const observer = new MutationObserver(applyDarkStyles);
  125. observer.observe(document.body, { childList: true, subtree: true });
  126.  
  127. // Initial run
  128. applyDarkStyles();
  129. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址