Contraster!

Contrast fixer

  1. // ==UserScript==
  2. // @name Contraster!
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description Contrast fixer
  6. // @author Cyxz
  7. // @match https://t3.chat/*
  8. // @grant none
  9. /// @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. const textcontrastfix = document.createElement('style');
  16. textcontrastfix.textContent = `
  17. .dark\\:prose-invert:is(.dark *) {
  18. --tw-prose-invert-body: #f5f5f5 !important;
  19. --tw-prose-body: var(--tw-prose-invert-body) !important;
  20. --tw-prose-headings: var(--tw-prose-invert-headings) !important;
  21. --tw-prose-lead: var(--tw-prose-invert-lead) !important;
  22. --tw-prose-links: var(--tw-prose-invert-links) !important;
  23. --tw-prose-bold: var(--tw-prose-invert-bold) !important;
  24. --tw-prose-counters: var(--tw-prose-invert-counters) !important;
  25. --tw-prose-bullets: var(--tw-prose-invert-bullets) !important;
  26. --tw-prose-hr: var(--tw-prose-invert-hr) !important;
  27. --tw-prose-quotes: var(--tw-prose-invert-quotes) !important;
  28. --tw-prose-quote-borders: var(--tw-prose-invert-quote-borders) !important;
  29. --tw-prose-captions: var(--tw-prose-invert-captions) !important;
  30. --tw-prose-kbd: var(--tw-prose-invert-kbd) !important;
  31. --tw-prose-kbd-shadows: var(--tw-prose-invert-kbd-shadows) !important;
  32. --tw-prose-code: var(--tw-prose-invert-code) !important;
  33. --tw-prose-pre-code: var(--tw-prose-invert-pre-code) !important;
  34. --tw-prose-pre-bg: var(--tw-prose-invert-pre-bg) !important;
  35. --tw-prose-th-borders: var(--tw-prose-invert-th-borders) !important;
  36. --tw-prose-td-borders: var(--tw-prose-invert-td-borders) !important;
  37. }
  38. .prose-pink:not(.dark *) {
  39. --tw-prose-links: #da006b;
  40. --tw-prose-invert-links: #f472b6;
  41. --tw-prose-body: #000000 !important;
  42. --tw-prose-headings: #111827 !important;
  43. --tw-prose-lead: #4b5563 !important;
  44. --tw-prose-bold: #111827 !important;
  45. }
  46. `;
  47. document.head.appendChild(textcontrastfix);
  48.  
  49. const darkwineVibe = document.createElement('style');
  50. darkwineVibe.textContent = `
  51. .dark {
  52. --background: 313.8 24.5% 8.4%;
  53. --foreground: 270 20% 97.8%;
  54. --card: 300 15.8% 6.7%;
  55. --card-foreground: 240 4.8% 95.9%;
  56. --popover: 320 23.08% 7.1%;
  57. --popover-foreground: 326 33% 96%;
  58. --primary: 332 100% 42%;
  59. --primary-foreground: 326 85% 95%;
  60. --secondary: 273.8 15.1% 20.8%;
  61. --secondary-foreground: 270 30% 90%;
  62. --muted: 283 9% 20%;
  63. --muted-foreground: 326 33% 90%;
  64. --accent: 272 20% 27%;
  65. --accent-foreground: 326 33% 96%;
  66. --destructive: 335.82 74.44% 45.29%;
  67. --destructive-foreground: 0 0% 100%;
  68. --border: 262.5 10% 20.7%;
  69. --input: 326.3 20% 15.7%;
  70. --ring: 333.3, 71.4%, 60.6%;
  71. --chart-1: 220 70% 60%;
  72. --chart-2: 160 60% 55%;
  73. --chart-3: 30 80% 65%;
  74. --chart-4: 280 65% 70%;
  75. --chart-5: 340 75% 65%;
  76. --sidebar-background: 240 2.6% 9.6%;
  77. --sidebar-foreground: 240 4.8% 95.9%;
  78. --sidebar-primary: 224.3 76.3% 58%;
  79. --sidebar-primary-foreground: 0 0% 100%;
  80. --sidebar-accent: 318.5 20.6% 18.4%;
  81. --sidebar-accent-foreground: 240 4.8% 95.9%;
  82. --sidebar-border: 0 0% 15%;
  83. --sidebar-ring: 333.3, 71.4%, 60.6%;
  84. --gradient-noise-top: 309 15% 10%;
  85. --chat-border: 334.3 32.6% 20.9%;
  86. --chat-background: 270 16.13% 10.16%;
  87. --chat-accent: rgba(20, 16, 24, .33);
  88. --color-heading: 328.1 39% 61.8%;
  89. }
  90. `;
  91. document.head.appendChild(darkwineVibe);
  92.  
  93. const lightvibe = document.createElement('style');
  94. lightvibe.textContent = `
  95. :root:not(.dark) {
  96. --background: 293.7 46.3% 96%;
  97. --foreground: 296 70% 18%;
  98. --card: 291 54% 98%;
  99. --card-foreground: 240 20% 20%;
  100. --popover: 0 0% 100%;
  101. --popover-foreground: 296 65% 17%;
  102. --primary: 334.2 74.9% 48%;
  103. --primary-foreground: 0 0% 100%;
  104. --secondary: 314.7 61.6% 82%;
  105. --secondary-foreground: 295.8 50% 25%;
  106. --muted: 327.7 61.6% 75%;
  107. --muted-foreground: 327 90% 28%;
  108. --accent: 314.7 65% 80%;
  109. --accent-foreground: 240 20% 20%;
  110. --destructive: 335 94% 42%;
  111. --destructive-foreground: 0 0% 100%;
  112. --border: 304.6 30% 88%;
  113. --input: 317.4 44.2% 80%;
  114. --ring: 333.3, 71.4%, 45%;
  115. --chart-1: 12 76% 55%;
  116. --chart-2: 173 65% 35%;
  117. --chart-3: 197 45% 22%;
  118. --chart-4: 43 74% 60%;
  119. --chart-5: 27 87% 60%;
  120. --radius: 0.5rem;
  121. --sidebar-background: 290.3 49.2% 85%;
  122. --sidebar-foreground: 240 20% 25%;
  123. --sidebar-primary: 240 20% 25%;
  124. --sidebar-primary-foreground: 0 0% 98%;
  125. --sidebar-accent: 330 30% 75%;
  126. --sidebar-accent-foreground: 240 15% 20%;
  127. --sidebar-border: 20 6% 90%;
  128. --sidebar-ring: 333.3, 71.4%, 45%;
  129. --gradient-noise-top: 292 42.9% 90%;
  130. --chat-border: 304.8 61% 80%;
  131. --chat-background: 300 56% 98%;
  132. --chat-accent: #f0e7f4;
  133. --color-heading: 336.3 75% 16%;
  134. }
  135. `;
  136. document.head.appendChild(lightvibe);
  137.  
  138. const themechangedetector = () => {
  139. const isDarkMode = document.documentElement.classList.contains('dark');
  140. console.log('theme change detected!!:', isDarkMode ? 'dark' : 'light');
  141. };
  142.  
  143. const observer = new MutationObserver(mutations => {
  144. mutations.forEach(mutation => {
  145. if (mutation.attributeName === 'class') {
  146. themechangedetector();
  147. }
  148. });
  149. });
  150.  
  151. observer.observe(document.documentElement, { attributes: true });
  152.  
  153. themechangedetector();
  154. })();