function chartRgb(interpolate) {
const height = 240;
const margin = ({top: 20, right: 30, bottom: 30, left: 40});
const x = d3.scaleLinear()
.range([margin.left, width - margin.right]);
const y = d3.scaleLinear()
.domain([0, 255])
.range([height - margin.bottom, margin.top]);
const xAxis = g => g
.attr("transform", `translate(0,${height - margin.bottom})`)
.call(d3.axisBottom(x).ticks(width / 80).tickSizeOuter(0));
const yAxis = g => g
.attr("transform", `translate(${margin.left},0)`)
.call(d3.axisLeft(y).ticks(8))
.call(g => g.select(".domain").remove());
const svg = d3.select(DOM.svg(width, height));
svg.append("g")
.call(xAxis);
svg.append("g")
.call(yAxis);
const g = svg.append("g")
.datum(Array.from({length: width}, (_, i) => i / (width - 1)))
.attr("fill", "none")
.attr("stroke-width", 1.5)
.attr("stroke-linejoin", "round")
.attr("stroke-linecap", "round");
g.append("path")
.attr("stroke", "#f00")
.attr("d", d3.line().x(x).y(t => y(d3.rgb(interpolate(t)).r)));
g.append("path")
.attr("stroke", "#0f0")
.attr("d", d3.line().x(x).y(t => y(d3.rgb(interpolate(t)).g)));
g.append("path")
.attr("stroke", "#00f")
.attr("d", d3.line().x(x).y(t => y(d3.rgb(interpolate(t)).b)));
return svg.node();
}