You have to use view formatting to customize entire row in a SharePoint list.
If you want to just apply the colors to entire row, you should use
additionalRowClass property to format the view.
Example: Considering internal name of your lookup column is
LookUpColumn, you can use JSON like:
"additionalRowClass": "=if([$LookUpColumn.lookupValue] > 75, 'sp-field-severity--good', if([$LookUpColumn.lookupValue] < 75 && [$LookUpColumn.lookupValue] > 50, 'sp-field-severity--low', if([$LookUpColumn.lookupValue] < 50 && [$LookUpColumn.lookupValue] > 25,'sp-field-severity--warning', if([$LookUpColumn.lookupValue] < 25,'sp-field-severity--blocked', ''))))"
Similarly, you can apply any of the predefined classes given in below links as per your requirements:
- Predefined classes
- Reusable SharePoint Online Classes for Modern UI
Update from comments:
[$lkpMile.lookupValue] is not working, try using
[$lkpMile] instead of
Not sure why
[$lkpMile.lookupValue] is not working for you. I have tried it my end & it is working fine for me.
Lookup column settings:
List view formatting output with simple JSON:
Microsoft documentation also says,
The lookup field object has the following properties (with example values):
"lookupValue": "North America",
Source: JSON formatting - Special string values - check "Lookup fields" section