I am using QGIS 3.28.
Use-case: I have a layer named: map_1, which is a map of many regions. The regions are identified with City_id. To distinguish the regions by their ID's, I first categorized them by random colors, and second added a label based on the field "City_id". See attached screenshots.
Problem: Since some regions are interfering with some others and/or are too tiny to be distinguished, it's hard to know the relevant regions for some labels.
For this reason, I thought of categorizing the labels using the same array of colors that was used for the parent layer. In other words, I want each label (i.e. City_id) to be colored with the same color as its referred region. Had I a small number of regions, I'd do this manually one by one, using the Rule-based method, but this unfortunately isn't the case, as I have several maps, with a total of ~3000 regions.
I guess this is very feasible, if only I could get the code of the categorization that was automatically generated for the layer and apply it the same in the Rule-based labeling.
However, there might probably be much more simple/efficient methods to solve my problem.
Any insight?
Image demonstrating the solution provided by @Mr_Yum below:
I'm adding the screenshot here, since it can't be added elsewhere (i.e. in a comment):
Having tried the @symbol_color, it worked.
P.S. I had vewed it before, but I didn't think it would work, because I saw in the description (to the right side): current value: #000000 (as seen in the screenshot) and I thought I should use some formula with python to make it work, so I didn't click OK!
If anyone may add an explanation of how does @symbol_color work, please do to enrich this issue.