Color Negative Spotlight
A photograph shifts to negative colors while a circular window retains its natural palette.
A photograph shifts to negative colors while a circular window retains its natural palette.
Live Demo
Hover over the element or use Tab to focus.
Source Code
Copy the HTML, CSS or JavaScript you need for your project.
<div class="tbx-1281" tabindex="0" role="img" aria-label="Color inversion with a circular spotlight on an image">
<svg class="tbx-1281__scene" viewBox="0 0 420 230" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><defs><linearGradient id="tbx1281sky" x2="1" y2="1"><stop stop-color="#f7d5b2"/><stop offset="1" stop-color="#c9dcbf"/></linearGradient></defs><rect width="420" height="230" fill="url(#tbx1281sky)"/><circle cx="305" cy="70" r="36" fill="#fff5c3"/><path d="M0 205L113 75l79 85 65-63 163 108v25H0" fill="#517f77"/><path d="M0 212l108-87 89 68 75-54 148 73v18H0" fill="#273e51"/><rect x="20" y="185" width="95" height="18" rx="5" fill="#eaab82"/></svg>
<svg class="tbx-1281__scene tbx-1281__normal" viewBox="0 0 420 230" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><defs><linearGradient id="tbx1281sky2" x2="1" y2="1"><stop stop-color="#f7d5b2"/><stop offset="1" stop-color="#c9dcbf"/></linearGradient></defs><rect width="420" height="230" fill="url(#tbx1281sky2)"/><circle cx="305" cy="70" r="36" fill="#fff5c3"/><path d="M0 205L113 75l79 85 65-63 163 108v25H0" fill="#517f77"/><path d="M0 212l108-87 89 68 75-54 148 73v18H0" fill="#273e51"/><rect x="20" y="185" width="95" height="18" rx="5" fill="#eaab82"/></svg>
<span class="tbx-1281__label">NEGATIVE / POSITIVE</span></div>
.tbx-1281{box-sizing:border-box;display:block;position:relative;max-width:100%;width:300px;aspect-ratio:420/230;border-radius:10px;overflow:hidden;isolation:isolate;background:#d6dccd;cursor:crosshair}
.tbx-1281__scene{display:block;width:100%;height:100%;position:absolute;inset:0;transition:filter .55s}
.tbx-1281__normal{clip-path:circle(100% at 70% 45%);transition:clip-path .65s ease}
.tbx-1281__label{position:absolute;left:11px;bottom:11px;z-index:3;padding:6px 9px;background:#182c39c9;color:#fff;border-radius:3px;font:700 10px/1 system-ui,sans-serif;letter-spacing:.08em}
.tbx-1281:hover .tbx-1281__scene:first-child,.tbx-1281:focus-visible .tbx-1281__scene:first-child{filter:invert(1) hue-rotate(155deg)}
.tbx-1281:hover .tbx-1281__normal,.tbx-1281:focus-visible .tbx-1281__normal{clip-path:circle(27% at 70% 45%)}
.tbx-1281:focus-visible{outline:3px solid #236987;outline-offset:4px}
@media(prefers-reduced-motion:reduce){.tbx-1281__scene,.tbx-1281__normal{transition:none}}
How to Use
Insert the HTML and add the CSS to your stylesheet. Adjust colors and sizes and avoid class conflicts.
Use Case
Useful for image galleries and photography portfolios.
Technical Notes
Keep controls usable on touch devices. Test keyboard focus and reduced-motion preferences.
Mobile: Ensure the interactive content remains accessible without hover on touch devices.
Browser: Uses modern CSS. Check behavior in the browsers you support.
Reduced Motion: Check that prefers-reduced-motion is respected.