@VisibleForTesting
	String decorateTarget(String oldTarget, PlayerIndicatorsService.Decorations decorations)
	{
		String newTarget = oldTarget;

		if (decorations.getColor() != null && config.colorPlayerMenu())
		{
			String prefix = "";
			int idx = oldTarget.indexOf("->");
			if (idx != -1)
			{
				prefix = oldTarget.substring(0, idx + 3); // <col=ff9040>Earth rune</col><col=ff> ->
				oldTarget = oldTarget.substring(idx + 3);
			}

			// <col=ff0000>title0RuneLitetitle1<col=ff>  (level-126)title2
			idx = oldTarget.indexOf('>');
			// remove leading <col>
			oldTarget = oldTarget.substring(idx + 1);

			newTarget = prefix + ColorUtil.prependColorTag(oldTarget, decorations.getColor());
		}

		FriendsChatRank rank = decorations.getFriendsChatRank();
		int image = -1;
		if (rank != null && rank != UNRANKED && config.showFriendsChatRanks())
		{
			image = chatIconManager.getIconNumber(rank);
		}
		else if (decorations.getClanTitle() != null && config.showClanChatRanks())
		{
			image = chatIconManager.getIconNumber(decorations.getClanTitle());
		}

		if (image != -1)
		{
			newTarget = "<img=" + image + ">" + newTarget;
		}

		return newTarget;
	}
@Test
	public void testDecorateTarget()
	{
		when(playerIndicatorsConfig.colorPlayerMenu()).thenReturn(true);

		String t0 = "title0";
		String name = "RuneLite";
		String t1 = "title1";
		String t2 = "title2";
		String col = "<col=ff>";

		String cmbLevel =  col + t0 + name + t1 + col + "  (level-126)" + t2;
		String skillTotal = col + t0 + name + t1 + "  (skill-1234)" + t2;

		// widget names contains the col tags
		String useCmb = "<col=ff9040>Earth rune</col>" + col + " -> " + cmbLevel;
		String useSkill = "<col=ff9040>Earth rune</col>" + col + " -> " + skillTotal;

		var deco = new PlayerIndicatorsService.Decorations(null, null, Color.RED);

		assertEquals("<col=ff0000>title0RuneLitetitle1<col=ff>  (level-126)title2", plugin.decorateTarget(cmbLevel, deco));
		assertEquals("<col=ff0000>title0RuneLitetitle1  (skill-1234)title2", plugin.decorateTarget(skillTotal, deco));

		assertEquals("<col=ff9040>Earth rune</col><col=ff> -> <col=ff0000>title0RuneLitetitle1<col=ff>  (level-126)title2", plugin.decorateTarget(useCmb, deco));
		assertEquals("<col=ff9040>Earth rune</col><col=ff> -> <col=ff0000>title0RuneLitetitle1  (skill-1234)title2", plugin.decorateTarget(useSkill, deco));
	}