<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: An Hoang Gia</title>
    <description>The latest articles on DEV Community by An Hoang Gia (@an_hoanggia_eb7d48d9de74).</description>
    <link>https://dev.to/an_hoanggia_eb7d48d9de74</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4024522%2F5be96145-9efb-4a1b-92f6-fb623fac4e1a.jpg</url>
      <title>DEV Community: An Hoang Gia</title>
      <link>https://dev.to/an_hoanggia_eb7d48d9de74</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/an_hoanggia_eb7d48d9de74"/>
    <language>en</language>
    <item>
      <title>How to Get the Exact HEX Color From Any Image (3 Free Ways)</title>
      <dc:creator>An Hoang Gia</dc:creator>
      <pubDate>Fri, 10 Jul 2026 21:01:37 +0000</pubDate>
      <link>https://dev.to/an_hoanggia_eb7d48d9de74/how-to-get-the-exact-hex-color-from-any-image-3-free-ways-4e08</link>
      <guid>https://dev.to/an_hoanggia_eb7d48d9de74/how-to-get-the-exact-hex-color-from-any-image-3-free-ways-4e08</guid>
      <description>&lt;p&gt;Every frontend dev hits this at some point: a designer sends you a screenshot, a client sends a logo, and you need the &lt;em&gt;exact&lt;/em&gt; HEX value of a color in it. Here are three quick ways to grab it — no Photoshop required.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Browser DevTools (built-in eyedropper)
&lt;/h2&gt;

&lt;p&gt;Chrome and Edge have a hidden eyedropper inside DevTools:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open DevTools (&lt;code&gt;F12&lt;/code&gt;) and inspect any element with a &lt;code&gt;color&lt;/code&gt; or &lt;code&gt;background-color&lt;/code&gt; property&lt;/li&gt;
&lt;li&gt;Click the little color swatch in the Styles panel&lt;/li&gt;
&lt;li&gt;The eyedropper is now active — hover anywhere on the page and click&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Limitation:&lt;/strong&gt; it only works on colors inside the current page. If your color lives in a JPG someone sent you in Slack, you first have to open that image in a tab.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. The EyeDropper API (do it in your own code)
&lt;/h2&gt;

&lt;p&gt;Modern Chromium browsers ship a native &lt;code&gt;EyeDropper&lt;/code&gt; API, so you can build color picking into your own tools:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;eyeDropper&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;EyeDropper&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;sRGBHex&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;eyeDropper&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;open&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;sRGBHex&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// e.g. "#7c3aed"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It returns the color of any pixel on the screen — even outside the browser window. Support is still Chromium-only (no Firefox/Safari as of 2026), so feature-detect with &lt;code&gt;if ('EyeDropper' in window)&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Upload the image to a color picker tool
&lt;/h2&gt;

&lt;p&gt;When you need more than one pixel — say, the full palette of a brand image — an image color picker is faster. I built &lt;a href="https://colorpicker.cx" rel="noopener noreferrer"&gt;ColorTools&lt;/a&gt; exactly for this workflow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Open &lt;a href="https://colorpicker.cx/color-picker" rel="noopener noreferrer"&gt;colorpicker.cx/color-picker&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Drop in any image (it never leaves your browser — processing is client-side)&lt;/li&gt;
&lt;li&gt;Click any pixel to get HEX, RGB and HSL, or let it extract the dominant palette automatically&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;From there you can jump straight into the &lt;a href="https://colorpicker.cx/contrast" rel="noopener noreferrer"&gt;contrast checker&lt;/a&gt; to verify WCAG AA/AAA compliance of the colors you just picked — handy when the "brand color" a client insists on is a 2.1:1 disaster on white.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus: converting between formats
&lt;/h2&gt;

&lt;p&gt;Got the HEX but need HSL for your CSS custom properties? The conversion is one formula, but if you do it rarely, a &lt;a href="https://colorpicker.cx/converter" rel="noopener noreferrer"&gt;converter&lt;/a&gt; is quicker than remembering the math.&lt;/p&gt;




&lt;p&gt;What's your workflow for grabbing colors — DevTools, a desktop app, or something else? Curious what everyone uses in 2026.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>css</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
