how to set style within a function?