# Cremote Changelog

## Version 2.2.1-contrast-detection-fix (2025-12-09)

### Improvements: Enhanced Text Color Detection

This patch improves the text color detection algorithm to properly handle complex nested DOM structures.

#### What Changed

**Enhanced Recursive Search Algorithm:**
- Previous version checked only direct children
- New version recursively searches all descendant elements
- Finds the element with the most text content (ignores `<br>`, empty elements)
- Properly handles structures like `<a><span>text</span><br></a>`

**Example Fix:**
```html
<a style="color: rgb(12, 113, 195)">
  <span style="color: #ffffff;">314-560-7171</span>
  <br>
</a>
```
- **Before:** Used `<a>` color (blue) = 4.17:1 contrast ❌
- **After:** Uses `<span>` color (white) = 21.00:1 contrast ✅

**Modified Files:**
- `daemon/daemon.go` - Lines 9301-9354: Implemented recursive `findTextBearingElement()` function

**Version Updates:**
- Daemon: `2.2.1-contrast-detection-fix`
- MCP Server: `2.2.1-contrast-detection-fix`
- CLI: `2.2.1`

---

## Version 2.2.0-contrast-detection-fix (2025-12-09)

### Major Improvements: Contrast Detection

This release fixes three critical issues in the WCAG contrast checking functionality that were causing false positives and incorrect reporting.

#### Fixed Issues

1. **Gradient Background Detection** ✅
   - **Problem:** Text on gradient backgrounds was incorrectly reported as white-on-white (1:1 ratio)
   - **Fix:** Enhanced gradient detection to walk up the DOM tree and find gradients on parent elements
   - **Impact:** Eliminates false positives for text on gradient backgrounds (e.g., hero sections with gradient overlays)

2. **Solid Background Priority** ✅
   - **Problem:** Gradient backgrounds were incorrectly applied to elements with solid backgrounds
   - **Fix:** Modified gradient detection to stop when encountering solid backgrounds - only applies gradients when no solid background exists between element and gradient
   - **Impact:** Ensures accurate background color detection for elements with solid backgrounds

3. **Child Element Text Color Detection** ✅
   - **Problem:** Tool used parent element's color (e.g., `<a>`) instead of child element's color (e.g., `<span>`)
   - **Fix:** Added recursive search to find the descendant element with the most text content and use its color
   - **Impact:** Accurate text color detection for complex DOM structures like `<a><span>text</span><br></a>`

### Technical Details

**Modified Files:**
- `daemon/daemon.go` - Lines 9152-9220: Enhanced `analyzeGradientContrast()` function
- `daemon/daemon.go` - Lines 9305-9340: Updated background detection logic
- `daemon/daemon.go` - Lines 9301-9354: Enhanced text color detection with recursive search

**Version Updates:**
- Daemon: `2.2.0-contrast-detection-fix`
- MCP Server: `2.2.0-contrast-detection-fix`
- CLI: `2.2.0`

### Testing

Test cases that now work correctly:
- ✅ White text on gradient backgrounds (e.g., `linear-gradient(rgb(12, 90, 201) 0%, rgb(0, 0, 0) 100%)`)
- ✅ Text on solid backgrounds with gradient ancestors
- ✅ Links with styled child spans (`<a><span style="color: ...">text</span></a>`)

### Upgrade Notes

After deploying this version:
1. Restart the cremote daemon service
2. Restart the MCP server or Augment extension
3. Re-run contrast audits on pages that previously showed false positives

### Documentation

See `GRADIENT_CONTRAST_FIX.md` for detailed technical documentation of the fixes.

---

## Version 2.1.0-visibility-fix

### Improvements
- Enhanced visibility detection for contrast checking
- Improved handling of hidden elements

---

## Version 2.0.1

### Initial Release
- Core cremote functionality
- Browser automation via Chrome DevTools Protocol
- Accessibility testing tools
- MCP server integration

