Hi,
A non-experimental way of solving this is to use a Custom Component. Custom Components can be created from the App Tree View under the Components Tab. Microsoft details for component creation are here:
Canvas component overview - Power Apps | Microsoft Learn (This guide explains it much better than I can).
By using a component, you could tackle this issue in two ways,
The first would be to template all your visuals in the component, and intake the values that need to be displayed.
The second would more closely emulate the behavior of the user defined functions system. You can create a hidden component that takes the name as a parameter, then returns the color. To do this I created a new component with a height and width of 0. I then created an input property "Name" and an output property of "Color"
Advanced menu I added the switch statement to the "Color (Output)" Data field.
To use this component, add it to your container from the Custom Menu in the add components dropdown.
Then set the Name property to be ThisItem.consultant, then set the Fill value of whatever you need to color to ColorSwitcher_1.Color (or whatever the name is in the tree view) and it should return the correct color. I would also set the visible property to false, even though the component already has a size of 0.