I'm uploading a css file from which I hope to log every color that is referenced.
So if the css file has {background-color:#ffffff; color:#000000;} , I hope to be able to create a list consisting of: #ffffff, #000000.
What would be the best way of doing this?
The project I am working on is on GitHub if you would like some reference: https://github.com/yeremenko/farbe
Thank you in advance for any help you might provide!
function getFileContents () {
var reader = new FileReader();
reader.onload = function(contents) {
var fileContents = contents.target.result; //Stores file contents
var singleColor = /*magic*/;
};
reader.readAsText(selectedFile); //Gets file contents into string
};
getFileContents();