A couple of problems:
"options" in your code is an array, which doesn't make a lot of sense. I've changed it to a single object, without the array.
Also, document.querySelectorAll returns a list of elements. A list doesn't have a "style" attribute, but the elements within the list do. Therefore you have to loop through them in order to make the change to each one:
document.addEventListener("DOMContentLoaded", function(event) {
var options = {
selector: '.test',
color: '#c3c3c3'
};
document.querySelectorAll(options.selector).forEach(function(element) {
element.style.backgroundColor = options.color;
});
});
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<title>JS Bin</title>
</head>
<body>
<div class="test">
This should be #c3c3c3
</div>
<div class="test">
This should be #c3c3c3
</div>
<div class="test">
This should be #c3c3c3
</div>
<div class="test">
This should be #c3c3c3
</div>
</body>
</html>
As noted in the comments, not all browser support forEach on a nodeList (as returned by querySelectorAll). In that case you could easily substitute it with a standard for
loop, like this:
var elements = document.querySelectorAll(options.selector);
for (var i = 0; i < elements.length; ++i) {
elements[i].style.backgroundColor = options.color;
}