# Player Color

Grammaroption|Current/Default player player color
FlagsNative | Function

Returns the player color of the player.

# Arguments

Returns — int<playercolor>

native int PlayerGetColorIndex(
	int inPlayer,
	bool inDefault,
);

Category: Player / Player Settings

# Examples

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zchar01.sc2map/MapScript.galaxy:842

        auto09291B66_var = UnitGroupUnitFromEnd(auto09291B66_g, auto09291B66_u);
        if (auto09291B66_var == null) { break; }
        UnitSetTeamColorIndex(auto09291B66_var, PlayerGetColorIndex(gv_pLAYER_02_ZERG, false));
    }
    auto9DF72A04_g = UnitGroup("InfestedCC", gv_pLAYER_02_ZERG2, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zexpedition01.sc2map/MapScript.galaxy:811

    UnitSetState(lp_cHOSEN_UNIT, c_unitStateTargetable, true);
    libNtve_gf_RescueUnit(lp_cHOSEN_UNIT, gv_pLAYER_01_USER, true);
    UnitSetTeamColorIndex(lp_cHOSEN_UNIT, PlayerGetColorIndex(gv_pLAYER_01_USER, false));
    SoundPlayAtPoint(SoundLink("Event_Expedition01_FreeRoachVox", -1), PlayerGroupAll(), UnitGetPosition(lp_cHOSEN_UNIT), 0.0, 100.0, 0.0);
    if (((UnitGroupCount(UnitGroup(null, gv_pLAYER_01_USER, RegionCircle(UnitGetPosition(lp_cHOSEN_UNIT), 6.0), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32)) | (1 << (c_targetFilterSummoned - 32))), 1), c_unitCountAlive) == 0) || (UnitGetOwner(lp_cHOSEN_UNIT) != gv_pLAYER_02_RESCUE_ZERG))) {

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zchar01.sc2mapMapScript.galaxy:842

        auto09291B66_var = UnitGroupUnitFromEnd(auto09291B66_g, auto09291B66_u);
        if (auto09291B66_var == null) { break; }
        UnitSetTeamColorIndex(auto09291B66_var, PlayerGetColorIndex(gv_pLAYER_02_ZERG, false));
    }
    auto9DF72A04_g = UnitGroup("InfestedCC", gv_pLAYER_02_ZERG2, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0);

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zexpedition01.sc2mapMapScript.galaxy:811

    UnitSetState(lp_cHOSEN_UNIT, c_unitStateTargetable, true);
    libNtve_gf_RescueUnit(lp_cHOSEN_UNIT, gv_pLAYER_01_USER, true);
    UnitSetTeamColorIndex(lp_cHOSEN_UNIT, PlayerGetColorIndex(gv_pLAYER_01_USER, false));
    SoundPlayAtPoint(SoundLink("Event_Expedition01_FreeRoachVox", -1), PlayerGroupAll(), UnitGetPosition(lp_cHOSEN_UNIT), 0.0, 100.0, 0.0);
    if (((UnitGroupCount(UnitGroup(null, gv_pLAYER_01_USER, RegionCircle(UnitGetPosition(lp_cHOSEN_UNIT), 6.0), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32)) | (1 << (c_targetFilterSummoned - 32))), 1), c_unitCountAlive) == 0) || (UnitGetOwner(lp_cHOSEN_UNIT) != gv_pLAYER_02_RESCUE_ZERG))) {

mods/core.sc2modbase.sc2data/TriggerLibs/DebugAI.galaxy:26

            1,
            StringToText("[") +
            PlayerColorName(PlayerGetColorIndex(player, false)) +
            StringToText("] ") +
            StringToText(s),

mods/core.stormmodbase.stormdata/TriggerLibs/DebugAI.galaxy:26

            1,
            StringToText("[") +
            PlayerColorName(PlayerGetColorIndex(player, false)) +
            StringToText("] ") +
            StringToText(s),

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/GameLib.galaxy:10018

    // Automatic Variable Declarations
    // Implementation
    return libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(libGame_gf_ComputerPlayerInTeam(lp_team), false));
}

mods/heroesdata.stormmodbase.stormdata/TriggerLibs/HeroesLib.galaxy:3795

        }
        else {
            PortraitSetTeamColor(lv_portrait, libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(0, false)));
        }
    }

mods/liberty.sc2modbase.sc2data/TriggerLibs/LibertyLib.galaxy:155

    }

    libNtve_gf_CreatePingFacingAngle(lv_pingPlayers, lv_pingMinimapModel, lp_pingLocation, libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(lp_player, false)), 5.0, 270.0);
    PingSetScale(PingLastCreated(), lv_pingScale);
    SoundPlayForPlayer(lv_pingSound, c_maxPlayers, lv_pingPlayers, 100.0, 0.0);

mods/liberty.sc2modbase.sc2data/TriggerLibs/LibertyLib.galaxy:242

    }

    libNtve_gf_CreatePingFacingAngle(lv_pingPlayers, lv_pingMinimapModel, lp_pingTargetPosition, libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(lp_player, false)), 5.0, 270.0);
    PingSetScale(PingLastCreated(), lv_pingScale);
    SoundPlayForPlayer(lv_pingSound, c_maxPlayers, lv_pingPlayers, 100.0, 0.0);

mods/liberty.sc2modbase.sc2data/TriggerLibs/LibertyLib.galaxy:335

    DialogControlCreate(DialogLastCreated(), c_triggerControlTypeLabel);
    libLbty_gv_meleeSurrender_Title[lp_player] = DialogControlLastCreated();
    libNtve_gf_SetDialogItemText(DialogControlLastCreated(), (TextWithColor(PlayerName(lp_player), libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(lp_player, false))) + StringExternal("Param/Value/lib_Lbty_1D191C56")), PlayerGroupAll());
    DialogControlSetSize(DialogControlLastCreated(), PlayerGroupAll(), 360, 50);
    libNtve_gf_SetDialogItemStyle(DialogControlLastCreated(), "AISurrenderTitle", PlayerGroupAll());

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:760

    libCOUI_gv_cU_CommanderAccountNameAlly = DialogControlLastCreated();
    libNtve_gf_SetDialogItemText(DialogControlLastCreated(), PlayerName(1), PlayerGroupSingle(2));
    libNtve_gf_SetDialogItemColor(DialogControlLastCreated(), libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(1, false)), PlayerGroupSingle(2));
    libNtve_gf_SetDialogItemText(DialogControlLastCreated(), PlayerName(2), PlayerGroupSingle(1));
    libNtve_gf_SetDialogItemColor(DialogControlLastCreated(), libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(2, false)), PlayerGroupSingle(1));

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:762

    libNtve_gf_SetDialogItemColor(DialogControlLastCreated(), libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(1, false)), PlayerGroupSingle(2));
    libNtve_gf_SetDialogItemText(DialogControlLastCreated(), PlayerName(2), PlayerGroupSingle(1));
    libNtve_gf_SetDialogItemColor(DialogControlLastCreated(), libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(2, false)), PlayerGroupSingle(1));
    DialogControlHookup(libCOUI_gv_cU_CommanderPanel, c_triggerControlTypeLabel, "AccountLabelSelf");
    libCOUI_gv_cU_CommanderAccountNameSelf = DialogControlLastCreated();

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:766

    libCOUI_gv_cU_CommanderAccountNameSelf = DialogControlLastCreated();
    libNtve_gf_SetDialogItemText(DialogControlLastCreated(), PlayerName(2), PlayerGroupSingle(2));
    libNtve_gf_SetDialogItemColor(DialogControlLastCreated(), libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(2, false)), PlayerGroupSingle(2));
    libNtve_gf_SetDialogItemText(DialogControlLastCreated(), PlayerName(1), PlayerGroupSingle(1));
    libNtve_gf_SetDialogItemColor(DialogControlLastCreated(), libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(1, false)), PlayerGroupSingle(1));

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:768

    libNtve_gf_SetDialogItemColor(DialogControlLastCreated(), libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(2, false)), PlayerGroupSingle(2));
    libNtve_gf_SetDialogItemText(DialogControlLastCreated(), PlayerName(1), PlayerGroupSingle(1));
    libNtve_gf_SetDialogItemColor(DialogControlLastCreated(), libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(1, false)), PlayerGroupSingle(1));
    DialogControlHookup(libCOUI_gv_cU_CommanderPanel, c_triggerControlTypeButton, "ReadyButton");
    libCOUI_gv_cU_CommanderReadyButton = DialogControlLastCreated();

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:973

            libNtve_gf_SetDialogItemPaused(libCOUI_gv_cU_CommanderButtonPortrait[lv_commIndex], false, lv_playerSelf);
            DialogControlSetVisible(libCOUI_gv_cU_CommanderButtonSelectionBorder[lv_commIndex], libCOOC_gv_cC_HumanPlayerGroup, true);
            libNtve_gf_SetDialogItemColor(libCOUI_gv_cU_CommanderButtonSelectionBorder[lv_commIndex], libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(lp_player, false)), libCOOC_gv_cC_HumanPlayerGroup);
        }
        else {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:984

                libNtve_gf_SetDialogItemPaused(libCOUI_gv_cU_CommanderButtonPortrait[lv_commIndex], false, libCOOC_gv_cC_HumanPlayerGroup);
                DialogControlSetVisible(libCOUI_gv_cU_CommanderButtonSelectionBorder[lv_commIndex], libCOOC_gv_cC_HumanPlayerGroup, true);
                libNtve_gf_SetDialogItemColor(libCOUI_gv_cU_CommanderButtonSelectionBorder[lv_commIndex], libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(libCOOC_gf_CC_PlayerAlly(lp_player), false)), libCOOC_gv_cC_HumanPlayerGroup);
            }
            else {

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:5988

    lv_mapScale = (lv_baseMapSize / MaxF(libNtve_gf_WidthOfRegion(RegionPlayableMap()), libNtve_gf_HeightOfRegion(RegionPlayableMap())));
    lv_mapScale = (lv_mapScale * lv_baseScale);
    libNtve_gf_CreatePingFacingAngle(PlayerGroupSingle(1), "PingViewArea", CameraGetTarget(2), libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(2, false)), 0.0, 270.0);
    PingSetScale(PingLastCreated(), lv_mapScale);
    libCOUI_gv_cU_MinimapAllyViewPing[1] = PingLastCreated();

mods/starcoop/starcoop.sc2modbase.sc2data/LibCOUI.galaxy:5991

    PingSetScale(PingLastCreated(), lv_mapScale);
    libCOUI_gv_cU_MinimapAllyViewPing[1] = PingLastCreated();
    libNtve_gf_CreatePingFacingAngle(PlayerGroupSingle(2), "PingViewArea", CameraGetTarget(1), libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(1, false)), 0.0, 270.0);
    PingSetScale(PingLastCreated(), lv_mapScale);
    libCOUI_gv_cU_MinimapAllyViewPing[2] = PingLastCreated();

mods/warcoop/warclassic.sc2modbase.sc2data/TriggerLibs/WarClassic.galaxy:1064

    lv_uT = EventPlayerEffectUsedUnitType(c_effectUnitCaster);
    lv_p = EventPlayerEffectUsedUnitOwner(c_effectPlayerCaster);
    lv_color = libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(lv_p, false));
    lv_ally = PlayerGroupAlliance(c_playerGroupAlly, lv_p);
    lv_prop = UnitGetName(lv_u);

mods/warcoop/warcoopdata.sc2modbase.sc2data/TriggerLibs/WarCoopData.galaxy:937

        if ((PlayerGroupHasPlayer(libWCdr_gv_legends.lv_legendPlayers, lv_currentIndex) == true)) {
            DialogControlSetAnimationState(libWCdr_gv_debugHeroSelectUI.lv_readyPanels[lv_currentIndex].lv_readyPanel, PlayerGroupAll(), libWCdr_gv_animationStates.lv_emptyState, libWCdr_gv_animationStates.lv_emptyState_NotEmpty);
            libNtve_gf_SetDialogItemColor(libWCdr_gv_debugHeroSelectUI.lv_readyPanels[lv_currentIndex].lv_playerLabel, libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(lv_currentIndex, false)), PlayerGroupAll());
            libNtve_gf_SetDialogItemText(libWCdr_gv_debugHeroSelectUI.lv_readyPanels[lv_currentIndex].lv_playerLabel, PlayerName(lv_currentIndex), PlayerGroupAll());
        }

mods/warcoop/warcoopdata.sc2modbase.sc2data/TriggerLibs/WarCoopData.galaxy:3088

        lv_player = PlayerGroupNextPlayer(auto187B1612_g, lv_player);
        if (lv_player < 0) { break; }
        libNtve_gf_SetDialogItemTeamColor(libWCdr_gv_gameUI.lv_hero_Portrait, libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(lv_player, false)), PlayerGroupSingle(lv_player));
        libNtve_gf_SetDialogItemCamera(libWCdr_gv_gameUI.lv_hero_Portrait, "Camera01", PlayerGroupAll());
    }

mods/warcoop/warmeleeai.sc2modbase.sc2data/TriggerLibs/DebugAIWar3.galaxy:26

            1,
            StringToText("[") +
            PlayerColorName(PlayerGetColorIndex(player, false)) +
            StringToText("] ") +
            StringToText(s),