You’ll need to move your logic into a function or use the ternary operator:
`${result['color 5'] ? 'color 5 exists!' : 'color 5 does not exist!'}`
Additional example based on comment:
`${result['color 5'] ?
`<div class="color" style=background-color:#${result['color 5']}><h6>${result['color 5']}</h6></div>`
: ''}`