If you go to the appearance tab on your Text widget, you can setup a dynamic class using expression.
You can declare a CSS class where you add yellow text, and use the dynamic class expression to add the class when the checkbox is set to true
That’s what dynamic classes are for. Depending on your theme you could use classes like ‘text-primary’ or ‘text-warning’, or create your own CSS rule like ‘text-yellow’.