This is because you cannot use a variable to indicate a name in an object literal.
The identifier in the object literal can be written with or without quotation marks, so it will not be interpreted as a variable in any case. The object will contain the identifier you specified:
{ "colorAttribute" : '#'+hex }
You can use a variable to set a property in an object, but then you need to create the object first and use the bracket syntax:
var obj = {};
obj[colorAttribute] = '#'+hex;
$(thisCLass).css(obj);