How can we check background, font style of some element without using executescript command?

Currently, I want to check background, text-color,… for some elements on my website. I have tried to use the “executeSrcipt” command and it has worked well. btw, when I use the “executeScript” command, I need to write this javascript too many times. Can I store that script and execute it anywhere?

Try to use this sourceextract with regex