There are a handful of dyes of which you can farm an unlimited amount. Traditionally he most common was green dye which is smelted from a 0 tick cactus farm. However, there are ways to farm unlimited amounts of certain flowers and then create dye from those.
The four flowers that can be farmed for unlimited amounts are the Lilac, the Rose Bush, the Peony and the Rose Bush. You will note that these flowers are all two blocks tall. Most flowers will grow in grass or dirt blocks. The trick in this instance is to create an enchanted hoe with the the Fortune enchantment on it, preferably Fortune III. When the double tall flowers are farmed with a Fortune III hoe double and sometimes triple the amount of the same flower are reaped as the reward. This in effect will allow you to quickly plant the flower, harvest it, plant the multiples you farmed and quickly expand your harvest to hundreds or even thousands within minutes. With all of these flowers you can create more dye than you’ll know what to do with. If you can’t find uses for all of the dye then you might get lucky finding a villager who will buy your dye for emeralds (some villagers will grade for dyes such as lime which can be made from combining green dye and white dye on the crafting table).
To create unlimited green dye you can create a 0 tick farm that produces cactuses (cactus). The cactus is then smelted into green dye. This has the added bonuses of serving as a limitless XP (experience) farm. Not only will limitless XP help you with enchanting your gear it can also serve as the fastest way to repair your gear if you are lucky enough to have the mending spell enchanted onto your tools, weapons and armor (mending enchantment books can purchased from some villagers, if you’re lucky enough to find one).
Cactus Farm / Green Dye Farm / XP Farm Tutorial
The following is an excellent YouTube tutorial for how to create the green dye farm.