As far as PTE liveries go, both of the main Strathclyde liveries lasted for 23 years (1983-2006 for Orange/Black and 1996-2019 for Carmine/Cream), each lasting a decade or more after their successors appeared. The last class to carry both was the 314.
Actually, come to think of it, 314202 holds the distinction of being one of the last units on the national network to carry both liveries, sharing the latter with 314205, it's partner during the farewell tour in December '19 (it held onto Orange/Black for nearly a year after the second-to-last unit was repainted in 2005).
The Regional Railways variant of ScotRail livery lasted until January 2002, with the final Class 305 withdrawal.