Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
fix: add a subtle gray circle to the visibility indicator in the top …
Browse files Browse the repository at this point in the history
…panel

the gray circle helps with the contrast for dark colours
  • Loading branch information
LangLangBart committed Mar 13, 2023
1 parent b9efa4f commit 5fbd986
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 12 deletions.
Binary file added art/textures/ui/session/phosphor/circle-empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added art/textures/ui/session/phosphor/circle-full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions gui/session/boonGUI_XML/sprites.xml
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,12 @@
size="0 0 100% 100%"
/>
</sprite>

<sprite name="emptyGrayCircle">
<effect add_color="95 95 95" />
<image
real_texture_placement="0 0 16 16"
texture="session/phosphor/circle-empty.png"
/>
</sprite>
</sprites>
13 changes: 8 additions & 5 deletions gui/session/stats/BoonGUIStatsTopPanelRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class BoonGUIStatsTopPanelRow
this.killDeathRatio = Engine.GetGUIObjectByName(`${PREFIX}_killDeathRatio`);

this.los = Engine.GetGUIObjectByName(`${PREFIX}_los`);
this.losHighlight = Engine.GetGUIObjectByName(`${PREFIX}_losHighlight`);

Engine.SetGlobalHotkey("structree", "Press", openStructTree);
Engine.SetGlobalHotkey("civinfo", "Press", openStructTree);
Expand Down Expand Up @@ -385,16 +386,18 @@ class BoonGUIStatsTopPanelRow
tooltip += "Cowards do not count in battle; they are there, but not in it. Euripides";

this.killDeathRatioHighlight.tooltip = tooltip;
// Ever present slightly gray coloured empty circle, defined in the xml part.
// Place a full circle in the player's color over the gray circle, the gray circle is slightly visible, this is good for contrast with dark colors.
if(state.hasSharedLos || state.numberAllies == 1)
this.los.sprite = `stretched:color:${state.playerColor}:textureAsMask:session/phosphor/circle-full.png`;

const los = state.hasSharedLos || state.numberAllies == 1 ? "●" : "○";
this.los.caption = setStringTags(los, { "color": state.playerColor });
color = state.brightenedPlayerColor;
tooltip = "";
tooltip += `${playerNick}\n`;
tooltip = `${playerNick}\n`;
font = "sans-stroke-20";
tooltip += `${setStringTags("○", { color, font })} / ${setStringTags("●", { color, font })}\n`;
tooltip += "Full circle when cartography has been researched or when you are without mutual allies.";
this.los.tooltip = tooltip;
this.losHighlight.tooltip = tooltip;

}
}

Expand Down
19 changes: 12 additions & 7 deletions gui/session/stats/sections/BoonGUIStatsTopPanel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -466,13 +466,18 @@
</object>

<object
name="StatsTopPanelRow[n]_los"
text_align="center"
font="sans-bold-20"
type="text"
size="950 0 960 100%"
tooltip_style="sessionToolTipCircle"
/>
name="StatsTopPanelRow[n]_losHighlight"
size="945 0 100% 100%"
type="button"
style="statsHighlighter">
<object
name="StatsTopPanelRow[n]_los"
size="20%-1 20%+1 80%+1 80%-1"
ghost="true"
type="image">
<object type="image" sprite="emptyGrayCircle" ghost="true" />
</object>
</object>
</object>
</repeat>
</object>
Expand Down

0 comments on commit 5fbd986

Please sign in to comment.