Greasy Fork is available in English.

Perplexity Prompt Text Ensmallifier

Reduces size of prompt text and puts it in a box

  1. // ==UserScript==
  2. // @name Perplexity Prompt Text Ensmallifier
  3. // @namespace Violentmonkey Scripts
  4. // @match *://www.perplexity.ai/*
  5. // @grant none
  6. // @version 2.1
  7. // @license MIT
  8. // @description Reduces size of prompt text and puts it in a box
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. function detectPerplexityTheme() {
  15. const bgColor = getComputedStyle(document.body).backgroundColor;
  16. return bgColor.includes("0.96") || bgColor.includes("0.963") ? 'light' : 'dark';
  17. }
  18.  
  19. function stylePromptHeading() {
  20. const elements = document.querySelectorAll('h1[class*="group/query"], div[class*="group/query"]');
  21. const theme = detectPerplexityTheme();
  22.  
  23. elements.forEach(el => {
  24. if (!el.classList.contains('custom-styled')) {
  25. el.style.padding = '10px';
  26. el.style.margin = '10px 0';
  27. el.style.borderRadius = '8px';
  28. el.style.display = 'block';
  29. el.style.color = 'inherit';
  30. el.style.fontSize = '0.875rem'; // 14px
  31. el.style.fontWeight = '400';
  32. el.style.lineHeight = '1.1'; // Tighter spacing
  33. el.style.overflowWrap = 'break-word';
  34.  
  35. if (theme === 'dark') {
  36. el.style.border = '1.6px solid rgba(255, 255, 255, 0.3)';
  37. el.style.background = 'rgba(255, 255, 255, 0.07)';
  38. } else {
  39. el.style.border = '1.6px solid rgba(0, 0, 0, 0.2)'; // Darker gray border
  40. el.style.background = 'rgba(0, 0, 0, 0.08)'; // **Stronger gray background**
  41. }
  42.  
  43. el.classList.add('custom-styled');
  44. }
  45. });
  46. }
  47.  
  48. // Run once on page load
  49. stylePromptHeading();
  50.  
  51. // Detect Perplexity theme changes (only works on reload)
  52. const observer = new MutationObserver(() => stylePromptHeading());
  53. observer.observe(document.body, { childList: true, subtree: true });
  54. })();