Eliastik/page-shadow
A Chrome, Firefox, Opera and Edge extension to increase contrast, decrase brightness and invert color of websites
What's novel
A Chrome, Firefox, Opera and Edge extension to increase contrast, decrase brightness and invert color of websites
Code Analysis
5 files read · 3 roundsA JavaScript class that analyzes image data to detect if an image or canvas element is 'dark' based on HSL luminance and transparency thresholds, with caching support.
Strengths
The implementation demonstrates solid separation of concerns by isolating pixel-level analysis (`isPixelDark`) from block-level context checks (`hasTransparentSurroundingPixels`). The use of SHA256 hashing for cache keys is a practical and efficient approach to memoization. Error handling via `debugLogger` provides a structured way to report issues without crashing.
Weaknesses
There are no visible tests, which makes it impossible to verify correctness or edge case coverage. Input validation is minimal (e.g., no checks for invalid image formats or corrupted data). The reliance on external config (`websiteSpecialFiltersConfig`) without inline defaults could lead to runtime errors if the config is missing.
Score Breakdown
Signal breakdown
Innovation
Craft
Traction
Scope
Evidence
Commits
69
Contributors
1
Files
182
Active weeks
14
Repository
Language
JavaScript
Stars
20
Forks
1
License
GPL-3.0