OK, my perfectionist nature (I didnât say I always adhere to my 80% ruleâŚ) condenses to this:
{% set temp = states('sensor.outdoor_temperature') | int %}
{% set temp_rgb = { 2:'255->232->244',3:'255->209->234',4:'255->184->222',5:'255->161->211',6:'255->138->202',7:'255->115->190',8:'255->89->178',9:'255->66->167',10:'255->43->156',11:'255->20->146',12:'245->18->158',13:'235->15->169',14:'224->13->179',15:'214->13->191',16:'207->10->200',17:'198->8->212',18:'186->5->222',19:'175->3->232',20:'167->0->245',21:'157->0->255',22:'140->0->255',23:'123->0->255',24:'111->0->255',25:'93->0->255',26:'76->0->255',27:'64->0->255',28:'47->0->255',29:'30->0->255',30:'17->0->255',31:'0->0->255',32:'0->25->252',33:'0->50->250',34:'0->75->250',35:'0->103->247',36:'0->126->245',37:'0->155->245',38:'0->178->242',39:'0->206->242',40:'0->228->240',41:'0->255->238',42:'5->250->217',43:'10->245->198',44:'15->242->182',45:'20->237->161',46:'26->232->143',47:'31->227->122',48:'36->222->101',49:'41->219->83',50:'46->214->66',51:'51->209->46',52:'61->214->41',53:'66->219->36',54:'75->222->31',55:'88->227->28',56:'96->232->23',57:'106->237->18',58:'112->242->13',59:'122->245->8',60:'132->250->5',61:'140->255->0',62:'153->255->0',63:'162->255->0',64:'174->255->0',65:'187->255->0',66:'195->255->0',67:'208->255->0',68:'221->255->0',69:'234->255->0',70:'242->255->0',71:'255->255->0',72:'255->247->0',73:'255->238->0',74:'255->230->0',75:'255->221->0',76:'255->213->0',77:'255->204->0',78:'255->200->0',79:'255->191->0',80:'255->183->0',81:'255->174->0',82:'255->162->0',83:'255->149->0',84:'255->136->0',85:'255->119->0',86:'255->106->0',87:'255->94->0',88:'255->81->0',89:'255->68->0',90:'255->55->0',91:'255->43->0',92:'255->38->0',93:'255->34->0',94:'255->30->0',95:'255->21->0',96:'255->17->0',97:'255->13->0',98:'255->9->0',99:'255->4->0'} %}
{% set output = temp_rgb[temp] %}
{% if temp < 2 %}
255 -> 255 -> 255
{% elif temp > 99 %}
43 -> 255 -> 113
{% else %}
{{ output }}
{% endif %}
I think I converted / created the array correctly