I would expect the car objects to have something like a color property on them. If this is true, you don't need computed property, and you can use the following snippet:
<div v-for="car in cars">
<span :color="car.color"></span>
</div>
However, it seems your code has more problems than just what you described. span is a native HTML element, and as far as I know, it has no color attribute, like your code seems to assume.
Also, your cars data property is an empty array, so looping throught it won't work very well. You would need something like this to make the previous snippet work (if we forget the span problem):
data() {
return {
cars: [
{ color: 'red' },
{ color: 'blue' }
]
}
}
UPDATE:
You don't need to use a computed property for that, you could rather use a method:
<div v-for="car in cars">
<span :color="getColor(car)"></span>
</div>
methods: {
getColor(car) {
if (car === 'a') {
return 'black'
} else if (car === 'b') {
return 'blue'
}
}
}