I am creating an app using python and I need to be able to colorize a PIL Image. I have several images similar to the following:

I want to be able to change the color of this icon easily based on a certain color in the color scheme defined as such
colorScheme = {
    "mainBackground": "#222426",
    "axis": "#323538",
    "dimTips": "#8d9096",
    "viewLayer": "blue",
    "editLayer": "red",
    "toolBackground": "#313336",
    "toolOutline": "#1c1d1f"
}
I specifically want to set it based on the "dimTips" option.
The images are referenced as follows so it is ideal to have an inline solution
self.icons = {
            "unlock": ImageTk.PhotoImage(Image.open("icons/unlock.png")),
            "locked": ImageTk.PhotoImage(Image.open("icons/locked.png"))
}
In theory this is easy to do but I want an option that preserves transparency and is not overkill.