High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
feat: add CSS filter-based emoji colorization system
Mario44968b0db3f1
diff --git a/.gitignore b/.gitignoreindex 51a3e6ca..951b5eb1 100644--- a/.gitignore+++ b/.gitignore@@ -8,6 +8,7 @@ dist/*.js!scripts/**/*.js!npm/bin/pinchtab+!internal/dashboard/dashboard/*.js# npm packagenpm/node_modules/diff --git a/docs/emoji-alternatives.md b/docs/emoji-alternatives.mdnew file mode 100644index 00000000..df2a49c2--- /dev/null+++ b/docs/emoji-alternatives.md@@ -0,0 +1,141 @@+# Emoji Colorization Alternatives++## Current Solution: CSS Filters++The implemented solution uses CSS filters to colorize emojis. This approach:+- ✅ Works with existing emoji+- ✅ No need to create new assets+- ✅ Maintains platform-specific emoji style+- ⚠️ Limited color control+- ⚠️ May not work perfectly with all emojis++## Alternative: AI-Generated Icons++If the CSS filter approach doesn't meet your needs, you can use Google's Gemini AI to generate consistent icon sets.++### Using Gemini to Create Icons++1. **Prepare a prompt for consistency:**+```+Create a set of minimalist, single-color icons in SVG format. Each icon should:+- Be 24x24 pixels+- Use only one color (#000000)+- Have consistent 2px stroke width+- Be simple and recognizable+- Use the same visual style++Create these icons:+1. A crab (mascot/brand icon)+2. A folder+3. A computer monitor+4. A warning triangle+5. A checkmark+6. An X mark+7. A locked padlock+8. An unlocked padlock+9. A bar chart+10. A target/bullseye+11. A stopwatch/timer+12. A floppy disk (save)+13. A refresh/circular arrow+14. A close button (X in circle)+```++2. **Request variations:**+- Ask for "more geometric" or "more organic" styles+- Request different stroke weights+- Ask for filled vs outlined versions++3. **Convert to colorizable format:**+- Ensure all SVGs use `currentColor` for fills/strokes+- Remove any hardcoded colors+- Optimize with SVGO or similar tools++### Implementation with AI-Generated Icons++```javascript+// Store AI-generated SVGs+const aiIcons = {+ crab: `<svg>...</svg>`, // Gemini-generated SVG+ folder: `<svg>...</svg>`,+ // etc.+};++// Create icon element+function createAIIcon(name, className = '') {+ const svg = aiIcons[name];+ if (!svg) return null;++ const span = document.createElement('span');+ span.className = `ai-icon ${className}`;+ span.innerHTML = svg;+ return span;+}+```++### CSS for AI Icons++```css+.ai-icon {+ display: inline-flex;+ width: 20px;+ height: 20px;+ color: var(--icon-color, currentColor);+}++.ai-icon svg {+ width: 100%;+ height: 100%;+}++/* Color variants */+.ai-icon.primary { color: var(--primary-color); }+.ai-icon.success { color: var(--success-color); }+.ai-icon.error { color: var(--error-color); }+/* etc. */+```++## Hybrid Approach++You can also combine both approaches:++1. Use CSS filters for emojis that colorize well+2. Use AI-generated SVGs for emojis that don't+3. Maintain consistency by using the same color system++```javascript+// Hybrid icon system+const iconSystem = {+ // Use emoji with CSS filter+ warning: { type: 'emoji', content: '⚠️', class: 'emoji-warning' },++ // Use AI-generated SVG+ crab: { type: 'svg', content: '<svg>...</svg>', class: 'ai-icon primary' },++ render(iconName) {+ const icon = this[iconName];+ if (icon.type === 'emoji') {+ return `<span class="${icon.class}">${icon.content}</span>`;+ } else {+ return `<span class="${icon.class}">${icon.content}</span>`;+ }+ }+};+```++## Comparison++| Approach | Pros | Cons |+|----------|------|------|+| CSS Filters | No new assets, Platform native, Easy to implement | Limited color control, Inconsistent results |+| AI Icons | Full control, Consistent style, Perfect colors | Need to generate, Larger file size |+| Hybrid | Best of both, Flexible | More complex, Two systems to maintain |++## Recommendations++1. **Start with CSS filters** (current implementation)+2. **Test thoroughly** across platforms/browsers+3. **If issues arise**, generate icons for problematic emojis+4. **Consider user preferences** - some may prefer native emoji++The CSS filter approach is implemented and ready to use. If you need AI-generated icons, tools like Google's Gemini, DALL-E, or Midjourney can create consistent icon sets based on your specifications.\ No newline at end of filediff --git a/docs/emoji-colorization.md b/docs/emoji-colorization.mdnew file mode 100644index 00000000..6c2d9779--- /dev/null+++ b/docs/emoji-colorization.md@@ -0,0 +1,182 @@+# Emoji Colorization Guide++This guide explains how to use the CSS filter-based emoji colorization system in Pinchtab.++## Overview++The emoji colorization system uses CSS filters to apply consistent colors to emoji icons. This approach:+- Preserves the original emoji shape and style+- Works across all platforms+- Supports theming (light/dark modes)+- Allows dynamic color changes++## How It Works++CSS filters are applied to emoji characters to change their appearance:+1. `grayscale(100%)` - Removes original colors+2. `sepia(1)` - Adds a base tint+3. `hue-rotate()` - Shifts to desired color+4. `saturate()` - Adjusts color intensity+5. `brightness()` - Adjusts for theme++## Available Colors++### Theme Colors+- `emoji-primary` - Primary brand color (blue)+- `emoji-success` - Success states (green)+- `emoji-warning` - Warning states (orange)+- `emoji-error` - Error states (red)+- `emoji-muted` - Disabled/inactive (gray)++### Specific Colors+- `emoji-blue`+- `emoji-red`+- `emoji-green`+- `emoji-purple`+- `emoji-orange`+- `emoji-yellow`++## Usage++### Automatic Colorization++The system automatically colorizes emojis when the page loads:++```javascript+// This happens automatically+// 🦀 → becomes blue (primary color)+// ⚠️ → becomes orange (warning color)+// ✓ → becomes green (success color)+```++### Manual HTML Usage++```html+<!-- Wrap emoji in span with color class -->+<span class="emoji emoji-primary">🦀</span>+<span class="emoji emoji-success">✓</span>+<span class="emoji emoji-error">❌</span>++<!-- Size variants -->+<span class="emoji emoji-primary emoji-xl">🦀</span>+<span class="emoji emoji-warning emoji-sm">⚠️</span>++<!-- Animations -->+<span class="emoji emoji-primary emoji-pulse">🔄</span>+<span class="emoji emoji-blue emoji-hover">📊</span>+```++### JavaScript API++```javascript+// Colorize text containing emojis+const colorized = emojiColors.colorizeText("🦀 Welcome to Pinchtab!");+element.innerHTML = colorized;++// Colorize all emojis in an element+emojiColors.colorizeElement(myDiv);++// Manually wrap an emoji+const wrapped = emojiColors.wrap('🦀', 'emoji-success');++// Change color of existing emoji element+const emojiElement = document.querySelector('.emoji');+emojiColors.addColorToEmoji(emojiElement, 'emoji-purple');+```++### Dynamic Content++The system automatically handles dynamically added content:++```javascript+// New emojis are automatically colorized+element.innerHTML += ' 🔒 Locked';+// The lock emoji will automatically get the muted color+```++## Customization++### Override Default Colors++```javascript+// Change default color for specific emoji+emojiColors.config['🦀'] = 'emoji-purple';++// Then reapply colorization+emojiColors.colorizeAll();+```++### Custom CSS++```css+/* Override filter values */+:root {+ --emoji-filter-primary: grayscale(100%) brightness(0.6) sepia(1) hue-rotate(200deg) saturate(4);+}++/* Custom color for specific context */+.my-special-section .emoji-primary {+ filter: grayscale(100%) brightness(0.8) sepia(1) hue-rotate(300deg) saturate(3);+}+```++## Emoji Configuration++Current emoji mappings:++| Emoji | Default Color | Usage |+|-------|---------------|-------|+| 🦀 | Primary (blue) | Pinchtab branding |+| 📁 | Orange | Folders, files |+| 🖥️ | Blue | Screens, displays |+| ⚠️ | Warning (orange) | Warnings |+| ✓ | Success (green) | Success, completion |+| ✗ | Error (red) | Errors, failures |+| 🔒 | Muted (gray) | Locked state |+| 🔓 | Success (green) | Unlocked state |+| 📊 | Blue | Charts, data |+| 🎯 | Primary (blue) | Targets, goals |+| ⏱️ | Purple | Time, duration |+| 💾 | Blue | Save, storage |+| 🔄 | Orange | Refresh, reload |+| ❌ | Error (red) | Close, cancel |++## Limitations++1. **Platform Differences** - Emoji appearance varies by OS/browser+2. **Complex Emojis** - Multi-color emojis may not colorize well+3. **Performance** - Too many filtered emojis can impact rendering+4. **Accessibility** - Screen readers still read the original emoji++## Best Practices++1. Use semantic color classes (`emoji-success` vs `emoji-green`)+2. Test in both light and dark modes+3. Provide text alternatives for important UI elements+4. Don't rely solely on color to convey meaning+5. Keep emoji usage consistent across the UI++## Examples in Context++```html+<!-- Status indicators -->+<div class="status-running">+ <span class="emoji emoji-success">✓</span> Running+</div>++<!-- Brand header -->+<h1 class="app-brand">+ <span class="emoji emoji-primary emoji-lg">🦀</span> Pinchtab+</h1>++<!-- Warning message -->+<div class="alert">+ <span class="emoji emoji-warning">⚠️</span>+ Configuration needs attention+</div>++<!-- Interactive elements -->+<button>+ <span class="emoji emoji-blue emoji-hover">💾</span> Save+</button>+```\ No newline at end of filediff --git a/internal/dashboard/dashboard/dashboard.html b/internal/dashboard/dashboard/dashboard.htmlindex f70033cc..5862a196 100644--- a/internal/dashboard/dashboard/dashboard.html+++ b/internal/dashboard/dashboard/dashboard.html@@ -9,6 +9,7 @@<link rel="stylesheet" href="/dashboard/profiles.css"><link rel="stylesheet" href="/dashboard/screencast.css"><link rel="stylesheet" href="/dashboard/settings.css">+<link rel="stylesheet" href="/dashboard/emoji-colors.css"></head><body>@@ -216,6 +217,7 @@</div><script src="/dashboard/utils.js"></script>+<script src="/dashboard/emoji-colors.js"></script><script src="/dashboard/agents.js"></script><script src="/dashboard/settings.js"></script><script src="/dashboard/screencast.js"></script>diff --git a/internal/dashboard/dashboard/emoji-colors.css b/internal/dashboard/dashboard/emoji-colors.cssnew file mode 100644index 00000000..db7d1a4a--- /dev/null+++ b/internal/dashboard/dashboard/emoji-colors.css@@ -0,0 +1,149 @@+/* Emoji Colorization System+ Using CSS filters to apply consistent colors to emoji icons */++:root {+ /* Define filter combinations for different colors */+ --emoji-filter-blue: grayscale(100%) brightness(0.5) sepia(1) hue-rotate(180deg) saturate(5);+ --emoji-filter-red: grayscale(100%) brightness(0.7) sepia(1) hue-rotate(0deg) saturate(5);+ --emoji-filter-green: grayscale(100%) brightness(0.7) sepia(1) hue-rotate(90deg) saturate(5);+ --emoji-filter-purple: grayscale(100%) brightness(0.6) sepia(1) hue-rotate(270deg) saturate(5);+ --emoji-filter-orange: grayscale(100%) brightness(0.7) sepia(1) hue-rotate(30deg) saturate(5);+ --emoji-filter-yellow: grayscale(100%) brightness(0.8) sepia(1) hue-rotate(45deg) saturate(5);++ /* Theme-aware filters */+ --emoji-filter-primary: var(--emoji-filter-blue);+ --emoji-filter-success: var(--emoji-filter-green);+ --emoji-filter-warning: var(--emoji-filter-orange);+ --emoji-filter-error: var(--emoji-filter-red);+ --emoji-filter-muted: grayscale(100%) brightness(0.7);+}++/* Dark mode adjustments */+:root.dark-mode {+ --emoji-filter-blue: grayscale(100%) brightness(0.9) sepia(1) hue-rotate(180deg) saturate(3);+ --emoji-filter-red: grayscale(100%) brightness(1) sepia(1) hue-rotate(0deg) saturate(3);+ --emoji-filter-green: grayscale(100%) brightness(1) sepia(1) hue-rotate(90deg) saturate(3);+ --emoji-filter-purple: grayscale(100%) brightness(0.9) sepia(1) hue-rotate(270deg) saturate(3);+ --emoji-filter-orange: grayscale(100%) brightness(1) sepia(1) hue-rotate(30deg) saturate(3);+ --emoji-filter-yellow: grayscale(100%) brightness(1.1) sepia(1) hue-rotate(45deg) saturate(3);+}++/* Base emoji wrapper class */+.emoji {+ display: inline-block;+ /* Ensure filter applies properly */+ font-style: normal;+ line-height: 1;+ /* Prevents text selection issues */+ -webkit-user-select: none;+ user-select: none;+}++/* Color variants */+.emoji-primary {+ filter: var(--emoji-filter-primary);+}++.emoji-blue {+ filter: var(--emoji-filter-blue);+}++.emoji-red {+ filter: var(--emoji-filter-red);+}++.emoji-green {+ filter: var(--emoji-filter-green);+}++.emoji-purple {+ filter: var(--emoji-filter-purple);+}++.emoji-orange {+ filter: var(--emoji-filter-orange);+}++.emoji-yellow {+ filter: var(--emoji-filter-yellow);+}++.emoji-success {+ filter: var(--emoji-filter-success);+}++.emoji-warning {+ filter: var(--emoji-filter-warning);+}++.emoji-error {+ filter: var(--emoji-filter-error);+}++.emoji-muted {+ filter: var(--emoji-filter-muted);+}++/* Size variants */+.emoji-sm {+ font-size: 0.875em;+}++.emoji-lg {+ font-size: 1.5em;+}++.emoji-xl {+ font-size: 2em;+}++.emoji-2xl {+ font-size: 3em;+}++/* Special cases for specific emojis that need adjustment */+.emoji-crab { /* 🦀 */+ filter: var(--emoji-filter-primary);+}++/* Animation for loading states */+@keyframes emoji-pulse {+ 0%, 100% {+ filter: var(--emoji-filter-muted);+ }+ 50% {+ filter: var(--emoji-filter-primary);+ }+}++.emoji-pulse {+ animation: emoji-pulse 2s ease-in-out infinite;+}++/* Hover effects */+.emoji-hover:hover {+ transform: scale(1.1);+ transition: transform 0.2s ease;+}++/* Apply to specific UI elements */+.app-brand .crab,+.empty-state .crab,+.modal h3 > span:first-child {+ filter: var(--emoji-filter-primary);+}++/* Status indicators */+.status-running .emoji {+ filter: var(--emoji-filter-success);+}++.status-error .emoji,+.error .emoji {+ filter: var(--emoji-filter-error);+}++.status-warning .emoji,+.warning .emoji {+ filter: var(--emoji-filter-warning);+}\ No newline at end of filediff --git a/internal/dashboard/dashboard/emoji-colors.js b/internal/dashboard/dashboard/emoji-colors.jsnew file mode 100644index 00000000..45ea9cda--- /dev/null+++ b/internal/dashboard/dashboard/emoji-colors.js@@ -0,0 +1,137 @@+// Emoji Colorization System+// Wraps emoji characters with spans that apply CSS filter colors++(function() {+ 'use strict';++ // Define emoji patterns and their default color classes+ const emojiConfig = {+ '🦀': 'emoji-primary', // Crab - primary brand color+ '📁': 'emoji-orange', // Folder+ '🖥️': 'emoji-blue', // Monitor+ '⚠️': 'emoji-warning', // Warning+ '✓': 'emoji-success', // Check+ '✗': 'emoji-error', // X+ '🔒': 'emoji-muted', // Lock+ '🔓': 'emoji-success', // Unlock+ '📊': 'emoji-blue', // Chart+ '🎯': 'emoji-primary', // Target+ '⏱️': 'emoji-purple', // Timer+ '💾': 'emoji-blue', // Save+ '🔄': 'emoji-orange', // Refresh+ '❌': 'emoji-error', // Close+ };++ // Regular expression to match all configured emojis+ const emojiRegex = new RegExp(+ '(' + Object.keys(emojiConfig).map(e => e.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|') + ')',+ 'g'+ );++ // Function to wrap an emoji with a colored span+ function wrapEmoji(emoji, className = '') {+ const defaultClass = emojiConfig[emoji] || 'emoji-muted';+ return `<span class="emoji ${className || defaultClass}">${emoji}</span>`;+ }++ // Function to colorize all emojis in a text string+ function colorizeEmojisInText(text, defaultClassName = '') {+ return text.replace(emojiRegex, (match) => {+ return wrapEmoji(match, defaultClassName);+ });+ }++ // Function to colorize all emojis in an element+ function colorizeEmojisInElement(element, defaultClassName = '') {+ // Process text nodes+ const walker = document.createTreeWalker(+ element,+ NodeFilter.SHOW_TEXT,+ {+ acceptNode: function(node) {+ // Skip if parent is already an emoji span+ if (node.parentElement && node.parentElement.classList.contains('emoji')) {+ return NodeFilter.FILTER_REJECT;+ }+ // Check if contains emoji+ return emojiRegex.test(node.textContent) ?+ NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;+ }+ }+ );++ const textNodes = [];+ while (walker.nextNode()) {+ textNodes.push(walker.currentNode);+ }++ // Process each text node+ textNodes.forEach(node => {+ const span = document.createElement('span');+ span.innerHTML = colorizeEmojisInText(node.textContent, defaultClassName);+ node.parentNode.replaceChild(span, node);+ });+ }++ // Function to colorize all emojis in the entire document+ function colorizeAllEmojis(defaultClassName = '') {+ colorizeEmojisInElement(document.body, defaultClassName);+ }++ // Helper to add color class to existing emoji elements+ function addColorToEmoji(element, colorClass) {+ if (!element.classList.contains('emoji')) {+ element.classList.add('emoji');+ }+ // Remove any existing color classes+ Object.values(emojiConfig).forEach(cls => {+ element.classList.remove(cls);+ });+ element.classList.remove('emoji-primary', 'emoji-blue', 'emoji-red',+ 'emoji-green', 'emoji-purple', 'emoji-orange', 'emoji-yellow',+ 'emoji-success', 'emoji-warning', 'emoji-error', 'emoji-muted');+ // Add new color class+ element.classList.add(colorClass);+ }++ // Mutation observer to handle dynamically added content+ function observeNewEmojis() {+ const observer = new MutationObserver((mutations) => {+ mutations.forEach((mutation) => {+ mutation.addedNodes.forEach((node) => {+ if (node.nodeType === Node.ELEMENT_NODE) {+ colorizeEmojisInElement(node);+ }+ });+ });+ });++ observer.observe(document.body, {+ childList: true,+ subtree: true+ });+ }++ // Auto-initialize on DOMContentLoaded+ if (document.readyState === 'loading') {+ document.addEventListener('DOMContentLoaded', () => {+ colorizeAllEmojis();+ observeNewEmojis();+ });+ } else {+ // DOM already loaded+ colorizeAllEmojis();+ observeNewEmojis();+ }++ // Export utilities for manual use+ window.emojiColors = {+ wrap: wrapEmoji,+ colorizeText: colorizeEmojisInText,+ colorizeElement: colorizeEmojisInElement,+ colorizeAll: colorizeAllEmojis,+ addColorToEmoji: addColorToEmoji,+ config: emojiConfig+ };++})();\ No newline at end of file