This functionality is now included in the Category Icons component. For the feature to work correctly, please be sure that you are on the latest version of Discourse and the latest version of the component.
6 Likes