'Create gradient legend with custom colours R

I am trying to create a gradient legend manually in R using the function AddGradientLegend. It all works well if I follow the recommendations here https://rdrr.io/cran/inlmisc/man/AddGradientLegend.html, the only problem is that I would like to be able to manually chose any colour and I am not able to do so so far.

AddGradientLegend(pal =  GetColors(scheme = "turbo"), breaks=  c(0,0.1,0.3,0.7,0.9,1))

enter image description here

The colours I would like to use are the following: c("#3B9AB2", "#78B7C5", "#EBCC2A", "#E1AF00", "#F21A00")

ERROR:

AddGradientLegend(pal =  c("#3B9AB2", "#78B7C5", "#EBCC2A", "#E1AF00", "#F21A00"), breaks=  c(0,0.1,0.3,0.7,0.9,1)) 
Error in AddGradientLegend(pal = c("#3B9AB2", "#78B7C5", "#EBCC2A", "#E1AF00",  
:Assertion on 'pal' failed: Must be a function, not 'character'.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source