Is there a way to set the text color of an ad-hoc selection in vimscript?
" change the text color of the first three rows to red :1,3 call changeTextColor('red')
As the link posted by @muru points out, it can be done, the following will highlight lines 3-5:
highlight FleetingFlashyFiretrucks ctermfg=red match FleetingFlashyFiretrucks /\%>2l\%<6l/
However, the highlighting defined this way is tied to the line numbers, not to the contents of the file. If you delete or insert lines before the highlighted region the highlight will stay at lines 3-5, while the contents will move up or down. For this reason it's almost always better to find a pattern in the text to highlight, rather than a line range.