Comparing two colored lines I have two colored lines, which can be thought of as functions I1,I2:[0,1]->R. I want to check whether I1 and I2 'topologically' represent the same object. In other words, if I stretch some parts of I1 and squeeze some other parts, I want to get I2.

Obviously they have to have the same colors and 'in the same order'.

Is there a metric that measures this kind of similarity?
If I consider that your colored lines are multivariate signals (in Red, Green, Blue), that might be related through local offsets and scalings (stretch and squeeze), I would suggest the method in Correlation based dynamic time warping of multivariate time series, Expert Systems with Applications, 2012. 

It combines Dynamic Time Warping (DTW), a widely used technique for comparison of time series data, and Principal Component Analysis (PCA)  to address the correlation between the variables. 

yet, you have to balance, in your metric, the 'shape' part and the 'color' part of the data. The associated quantities do not live in the same space.