magic pencil

Hi all, would anyone have an idea as how to create a “magic pencil” brush? by magic pencil I mean a brush that would be constantly but gradually changing colours like those thick pencils for children. Is it imaginable for someone to write a script for that?
here’s an example of a product by koh i noor that does on paper what I need to achieve within harmony: