ColorToolkits
CSS & Gradients

HEX to CSS Filter Generator

Colorize black PNG or external image icons to match any brand color using pure CSS filter properties, with live side-by-side preview.

Target Color
#2563EB
Filtered Black ResultPerfect (Loss 0.04)
Approx #2663EC
Sample Monochrome Icon
Black fill SVG tinted solely via CSS filter
Generated CSS Declaration
.icon-tint {
  filter: brightness(0) saturate(100%) invert(34%) sepia(99%) saturate(1031%) hue-rotate(202deg) brightness(87%) contrast(115%);
}

How to Use This Tool

  1. Enter or pick your target brand HEX color.
  2. Inspect the computed perceptual loss rating ("Perfect", "Close", or "Approximate") and side-by-side preview icons.
  3. Click Recompute if you want another stochastic search seed, then copy the CSS filter property.

Key Features

  • Pure TypeScript SPSA multi-start optimizer solves accurate filter chains in milliseconds
  • Displays Target Swatch beside Simulated Filter Swatch plus numeric Perceptual Loss indicator
  • Live preview rendered over sample monochrome UI icons on Light & Dark surfaces
  • One-click copy for complete CSS filter declaration and "Solve Lower Loss" recompute option

Frequently Asked Questions

More Color Tools

View all tools →