Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i9 #364

Open
Woroc opened this issue Jan 30, 2025 · 0 comments
Open

i9 #364

Woroc opened this issue Jan 30, 2025 · 0 comments

Comments

@Woroc
Copy link

Woroc commented Jan 30, 2025


🔍 1. Fixing Fragile Discord Selectors

The Problem:
Our theme currently relies on Discord's class names (e.g., .container-2cd8Mz). The issue? Discord updates frequently, breaking our styles when these classes change.

How to Fix It:

  • Use CSS variables instead of hardcoded class names wherever possible.
  • Build in error resilience:
    const sidebar = document.querySelector('[aria-label="Server sidebar"]');
    if (sidebar) {
      injectCatppuccinStyles(sidebar);
    } else {
      console.log("🔍 Catppuccin: Sidebar not found—did Discord update?");
    }
  • Pro Tip: Setting up a Canary build monitor helps us catch UI changes before they cause major issues.

2. Improving Performance

The Issue:
Heavy CSS/JS injections could slow down Discord’s startup.

🚀 Optimizations:

  • Use requestIdleCallback for non-essential animations:
    requestIdleCallback(() => {
      applyFancyAnimations();
    });
  • Minify CSS/JS for production builds (Webpack/Rollup can help!).

🌈 3. Accessibility Check

Why It Matters:
Some pastel colors might not meet contrast standards, making the theme harder to read for some users.

🛠️ Solution:

  • Run an audit using [Axe DevTools](https://deque.com/axe/).
  • Ensure at least a 4.5:1 contrast ratio for readability:
    $text: #cdd6f4; // Light text  
    $base: #1e1e2e; // Dark background  

🧹 4. Preventing Memory Leaks

Potential Issue:
Event listeners for theme toggles may not get removed properly, leading to memory leaks.

🔧 Solution:

  • Always remove event listeners when the theme is disabled:
    let themeToggleListener = null;
    
    function setupThemeToggle() {
      const toggleButton = document.querySelector('#catppuccin-toggle');
      themeToggleListener = () => toggleTheme();
      toggleButton?.addEventListener('click', themeToggleListener);
    }
    
    window.addEventListener('beforeunload', () => {
      toggleButton?.removeEventListener('click', themeToggleListener);
    });

📖 5. Improving Documentation

What’s Missing?

  • A troubleshooting guide for conflicts with other themes.
  • Contributor guidelines for color scheme updates.

📝 Let’s Update README.md with:

## 🚑 Troubleshooting  
- **Theme not applying?**  
  1. Disable conflicting extensions (BetterDiscord/Vencord).  
  2. Clear Discord cache (`Ctrl + R` twice).  
- **If a Discord update breaks the theme, submit an issue!**  

## 🎨 Contributing  
- Follow the [Catppuccin palette guidelines](https://github.com/catppuccin/palette).  
- Test changes on **Discord Canary** before submitting PRs.  

🔄 6. Safer Dependency Management

Problem:
Our package.json has hardcoded versions ("sass": "1.54.0"), which can miss security updates.

Solution: Use caret (^) for minor updates:

"devDependencies": {
  "sass": "^1.69.0",
  "webpack": "^5.89.0"
}

Run npm outdated regularly to stay up to date!


🌍 7. Adding Localization Support

Why?
Catppuccin has a global community, so let’s make the theme more accessible!

🌎 How to Add i18n:

  1. Create a lang/ folder with JSON files for translations:
    // lang/es-ES.json
    {
      "themeName": "Tema Catppuccin",
      "description": "Un tema suave y acogedor para Discord."
    }
  2. Load translations based on Discord’s language setting.

🛠️ Bonus Maintenance Tips

✅ Set up GitHub Actions to:

  • Lint CSS/JS automatically.
  • Check for deprecated Discord class names.

✅ Add an ISSUE_TEMPLATE.md to guide bug reports.
✅ Keep a CHANGELOG.md so users can track updates.


🎨 Final Touches

  • Show Off the Theme! Add screenshots of dark & light modes to the README.
  • Use Semantic Versioning: Run npm version patch/minor/major for clear updates.
  • Create a Discord Server for support and community feedback!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant