any code for making text inside [square brackets] turn green?
1 Like
You could easily achieve what you want via JavaScript with something like the following code:
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll(".green-brackets").forEach((element) => {
element.innerHTML = element.innerHTML.replace(/\u005B([^\u005D]+)\u005D/g, '<span style="color: green;">[$1]</span>');
});
});
This basically waits for the card to be fully loaded DOMContentLoaded
then selects all elements with the class green-brackets
to replace its contents with the same text wrapped in a <span>
that applies the green CSS color.
This approach modifies the innerHTML
property so avoid using it on elements containing interactive or complex content to prevent breaking event listeners or reloading already loaded images.
3 Likes
You can place a around the content and then update the style at the bottom of the card.
For example: <span class="green-text">*my text*</span>
.
1 Like
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.