Итак, вы хотите выбрать элемент, который содержит слово фиолетовый.Селектор текста не содержит CSS, поэтому вам нужно будет взять все списки, а затем найти / отфильтровать их, чтобы найти фиолетовые.
Если есть только один:
const purpleElem = Array.from(document.querySelectorAll("li")) // find all the lis
.find(li => // locate the element that has the match
li.textContent.contains('Purple') // see if it has purple
)
Если их несколько
const purpleElems = Array.from(document.querySelectorAll("li")) // find all the lis
.filter(li => // filter the list of lis
li.textContent.contains('Purple') // see if it has purple
)