Forum Discussion
Extracting Hex Color Codes from Websites
I am looking for a way to extract hex color codes from the code of a webpage. I have a number of websites that we manage and would like to scrape the site to extract their color schemes for marketing research purposes.
Hex color codes are always #CCC or #CCCCCC, example:
color: #FFF;
background: #57C2BD;
So if I can import the html for the site, I am fairly confident I can extract these color codes. The issue I am having is finding a way to get PowerBI to import the raw html of the page versus the document/table format which is cumbersom and only appears to let me get to the visible text on the page.
Any suggestions would be appreciated.
5 Replies
- stretcharmMemorable Member
If you have firefox there is an eyedropper in the developer tools that shows the hex value when you hover over.
https://developer.mozilla.org/en-US/docs/Tools/Eyedropper
Chrome dev tools have a similar tool, but its not as easy to get to.
https://paul.kinlan.me/eyedropper-chrome-dev-tools/
- bwelshHelper I
I aware of these tools, however we need a way to programatically extract the hex color codes. We have a large number of websites we need to scrape.
- stretcharmMemorable Member
OK.
Something like this should work. I used this technique it to strip out links form a web site before.
From here you can split and filter your html source code.
let Source = Table.FromColumns({Lines.FromBinary(Web.Contents("https://www.microsoft.com/en-us/"))}) in Source