I want to improvise my regression plot shade which is proportional to density. For example is the confidence interval is narrow the shade is dense while if confidence interval wide the fill color is light. The result graph might look like this:

Here is an working example:
set.seed(1234)
md <- c(seq(0.01, 1, 0.01), rev(seq(0.01, 1, 0.01)))
cv <- c(rev(seq(0.01, 1, 0.01)), seq(0.01, 1, 0.01))
rv <- rnorm (length(md), 0.1, 0.05)
df <- data.frame(x =1:length(md), F = md*2.5 + rv, L =md*2.5 -rv-cv, U =md*2.5+ rv+ cv)
plot(df$x, df$F, ylim = c(0,4), type = "l")
polygon(c(df$x,rev(df$x)),c(df$L,rev(df$U)),col = "cadetblue", border = FALSE)
lines(df$x, df$F, lwd = 2)
#add red lines on borders of polygon
lines(df$x, df$U, col="red",lty=2)
lines(df$x, df$L, col="red",lty=2)
The
densregion()command in thedenstrippackage seems to do what you want. A little adaptation from the example in its help page: