Spec Icons in Portraits

So my goal is to have Spec Icons in the Player Portraits.

There are a lot of addons and scripts for doing Class Icons in the Player Portraits something like this

hooksecurefunc(“UnitFramePortrait_Update”,function(self)
if self.unit == “player” or self.unit == “pet” then
return
end
if self.portrait then
if UnitIsPlayer(self.unit) then
local t = CLASS_ICON_TCOORDS[select(2,UnitClass(self.unit))]
if t then
self.portrait:SetTexture(“Interface\TargetingFrame\UI-Classes-Circles”)
self.portrait:SetTexCoord(unpack(t))
end
else
self.portrait:SetTexCoord(0,1,0,1)
end
end
end);

But I never see anything for Spec Icons if someone knows i can modify the above script to make it spec icons instead that would be huge or knows another addon that does it so i can see the code they are using and re write it myself.

Thank you in advance for any help people can provide.

The primary problem is the mechanism to detect specs for units other than the “player” is via inspection (not guaranteed to be known when a unit changes) and there is no event to detect spec. change other than PLAYER_SPECIALIZATION_CHANGED which is fine for the player unit.