Fix for linux console

When I login (to the linux console), it doesn't work and outputs printf statements. This is because I source gruvbox_256palette.sh in my .zshrc and zsh reads .zshrc on login (similarly for bash). My question is, is this the correct way to account for it (the output goes away upon login when I use this), or is there another, perhaps better, way of avoiding it?

Thanks.