Changed Black in UI to Charcoal - see #12591
Some checks failed
Build and test / Check code and run unit tests (push) Failing after 1h41m8s
Conflict marking / main (push) Failing after 9s
Detekt / detekt (ubuntu-latest) (push) Failing after 39s
Docker / build (push) Failing after 1m23s
Generate mkdocs from docs folder / deploy (push) Failing after 37s

This commit is contained in:
yairm210 2024-12-13 11:00:51 +02:00
parent dcaf9c421a
commit 212e7233b3
40 changed files with 91 additions and 84 deletions

View File

@ -12,6 +12,7 @@ import com.unciv.models.ruleset.unique.UniqueType
import com.unciv.models.translations.squareBraceRegex
import com.unciv.models.translations.tr
import com.unciv.ui.components.extensions.colorFromRGB
import com.unciv.ui.images.ImageGetter
import com.unciv.ui.objectdescriptions.BaseUnitDescriptions
import com.unciv.ui.objectdescriptions.BuildingDescriptions
import com.unciv.ui.objectdescriptions.ImprovementDescriptions
@ -94,7 +95,7 @@ class Nation : RulesetObject() {
fun setTransients() {
outerColorObject = colorFromRGB(outerColor)
innerColorObject = if (innerColor == null) Color.BLACK
innerColorObject = if (innerColor == null) ImageGetter.CHARCOAL
else colorFromRGB(innerColor!!)
forestsAndJunglesAreRoads = uniqueMap.hasUnique(UniqueType.ForestsAndJunglesAreRoads)

View File

@ -22,6 +22,7 @@ import com.unciv.models.stats.Stats
import com.unciv.models.tilesets.TileSetCache
import com.unciv.models.tilesets.TileSetConfig
import com.unciv.ui.images.AtlasPreview
import com.unciv.ui.images.ImageGetter
import com.unciv.ui.images.Portrait
import com.unciv.ui.images.PortraitPromotion
@ -724,9 +725,9 @@ class RulesetValidator(val ruleset: Ruleset) {
if (innerColorLuminance > outerColorLuminance) { // inner is brighter
innerLerpColor = Color.WHITE
outerLerpColor = Color.BLACK
outerLerpColor = ImageGetter.CHARCOAL
} else {
innerLerpColor = Color.BLACK
innerLerpColor = ImageGetter.CHARCOAL
outerLerpColor = Color.WHITE
}

View File

@ -2,12 +2,13 @@ package com.unciv.models.tilesets
import com.badlogic.gdx.graphics.Color
import com.unciv.Constants
import com.unciv.ui.images.ImageGetter
class TileSetConfig {
var useColorAsBaseTerrain = false
var useSummaryImages = false
var unexploredTileColor: Color = Color.DARK_GRAY
var fogOfWarColor: Color = Color.BLACK
var fogOfWarColor: Color = ImageGetter.CHARCOAL
/** Name of the tileset to use when this one is missing images. Null to disable. */
var fallbackTileSet: String? = Constants.defaultFallbackTileset
/** Scale factor for hex images, with hex center as origin. */

View File

@ -87,7 +87,7 @@ interface ISortableGridContentProvider<IT, ACT> {
@JvmStatic
fun getCircledIcon(path: String, iconSize: Float, circleColor: Color = Color.LIGHT_GRAY) =
ImageGetter.getImage(path)
.apply { color = Color.BLACK }
.apply { color = ImageGetter.CHARCOAL }
.surroundWithCircle(iconSize, color = circleColor)
@JvmStatic

View File

@ -91,9 +91,9 @@ fun colorFromHex(hexColor: Int): Color {
fun colorFromRGB(r: Int, g: Int, b: Int) = Color(r / 255f, g / 255f, b / 255f, 1f)
/** Create a new [Color] instance from r/g/b given as Integers in the range 0..255 in the form of a 3-element List [rgb] */
fun colorFromRGB(rgb: List<Int>) = colorFromRGB(rgb[0], rgb[1], rgb[2])
/** Linearly interpolates between this [Color] and [BLACK][Color.BLACK] by [t] which is in the range [[0,1]].
/** Linearly interpolates between this [Color] and [BLACK][ImageGetter.CHARCOAL] by [t] which is in the range [[0,1]].
* The result is returned as a new instance. */
fun Color.darken(t: Float): Color = Color(this).lerp(Color.BLACK, t)
fun Color.darken(t: Float): Color = Color(this).lerp(ImageGetter.CHARCOAL, t)
/** Linearly interpolates between this [Color] and [WHITE][Color.WHITE] by [t] which is in the range [[0,1]].
* The result is returned as a new instance. */
fun Color.brighten(t: Float): Color = Color(this).lerp(Color.WHITE, t)
@ -117,7 +117,7 @@ fun Actor.surroundWithCircle(
return IconCircleGroup(size, this, resizeActor, color, circleImageLocation)
}
fun Actor.surroundWithThinCircle(color: Color=Color.BLACK): IconCircleGroup = surroundWithCircle(width+2f, false, color)
fun Actor.surroundWithThinCircle(color: Color=ImageGetter.CHARCOAL): IconCircleGroup = surroundWithCircle(width+2f, false, color)
fun Actor.addBorder(size: Float, color: Color, expandCell: Boolean = false): Table {

View File

@ -51,7 +51,7 @@ class InfluenceTable(
setSize(width, height)
background = BaseScreen.skinStrings.getUiBackground(
"WorldScreen/CityButton/InfluenceBar",
tintColor = Color.BLACK)
tintColor = ImageGetter.CHARCOAL)
val normalizedInfluence = max(-60f, min(influence, 60f)) / 30f
@ -115,11 +115,11 @@ private class DefenceTable(city: City) : BorderedTable(
val selectedCiv = GUI.getSelectedPlayer()
borderSize = 4f
bgColor = Color.BLACK
bgColor = ImageGetter.CHARCOAL
bgBorderColor = when {
city.civ == selectedCiv -> colorFromRGB(255, 237, 200)
city.civ.isAtWarWith(selectedCiv) -> Color.RED
else -> Color.BLACK
else -> ImageGetter.CHARCOAL
}
pad(2f, 3f, 0f, 3f)
@ -216,7 +216,7 @@ private class CityTable(city: City, forPopup: Boolean = false) : BorderedTable(
bgBorderColor = when {
city.civ == selectedCiv -> colorFromRGB(233, 233, 172)
city.civ.isAtWarWith(selectedCiv) -> colorFromRGB(230, 51, 0)
else -> Color.BLACK
else -> ImageGetter.CHARCOAL
}
borderSize = when {
city.civ == selectedCiv -> 4f
@ -269,7 +269,7 @@ private class CityTable(city: City, forPopup: Boolean = false) : BorderedTable(
val growthBar = ImageGetter.getProgressBarVertical(4f, 30f,
if (city.isStarving()) 1.0f else growthPercentage,
if (city.isStarving()) Color.RED else CityButton.ColorGrowth, Color.BLACK, 1f)
if (city.isStarving()) Color.RED else CityButton.ColorGrowth, ImageGetter.CHARCOAL, 1f)
growthBar.color.a = 0.8f
val turnLabelText = when {
@ -367,7 +367,7 @@ private class CityTable(city: City, forPopup: Boolean = false) : BorderedTable(
}
val productionBar = ImageGetter.getProgressBarVertical(4f, 30f, percentage,
CityButton.ColorConstruction, Color.BLACK, 1f)
CityButton.ColorConstruction, ImageGetter.CHARCOAL, 1f)
productionBar.setSemiProgress(CityButton.ColorConstruction.cpy().darken(0.4f), nextTurnPercentage, 1f)
productionBar.color.a = 0.8f

View File

@ -32,7 +32,7 @@ class YieldGroup : HorizontalGroup() {
fun getIcon(statName: String) =
ImageGetter.getStatIcon(statName).surroundWithCircle(12f)
.apply { circle.color = Color.BLACK;circle.color.a = 0.5f }
.apply { circle.color = ImageGetter.CHARCOAL; circle.color.a = 0.5f }
private fun getStatIconsTable(statName: String, number: Int): Table {
val table = Table()
@ -57,7 +57,7 @@ class YieldGroup : HorizontalGroup() {
val group = Group().apply { setSize(22f, 22f) }
val largeImage = ImageGetter.getStatIcon(statName).surroundWithCircle(22f)
.apply { circle.color = Color.BLACK;circle.color.a = 0.5f }
.apply { circle.color = ImageGetter.CHARCOAL;circle.color.a = 0.5f }
group.addToCenter(largeImage)
if (number > 5) {
@ -67,7 +67,7 @@ class YieldGroup : HorizontalGroup() {
fontColor = Color.WHITE,
alignment = Align.center
)
val amountGroup = label.surroundWithCircle(10f, true, Color.BLACK)
val amountGroup = label.surroundWithCircle(10f, true, ImageGetter.CHARCOAL)
label.y -= 0.5f
amountGroup.x = group.width - amountGroup.width * 3 / 4
amountGroup.y = -amountGroup.height / 4

View File

@ -214,7 +214,7 @@ class TileLayerMisc(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup, si
if (DebugUtils.SHOW_TILE_COORDS) {
val label = this.tile().position.toPrettyString()
startingLocationIcons.add(label.toLabel(Color.BLACK.cpy().apply { a = 0.7f }, 14).apply {
startingLocationIcons.add(label.toLabel(ImageGetter.CHARCOAL.cpy().apply { a = 0.7f }, 14).apply {
tileGroup.layerMisc.addActor(this)
setOrigin(Align.center)
center(tileGroup)
@ -265,7 +265,7 @@ class TileLayerMisc(tileGroup: TileGroup, size: Float) : TileLayer(tileGroup, si
// Add a Label with the total count for this tile
if (nations.size > 3) {
// Tons of locations for this tile - display number in red, behind the top three
startingLocationIcons.add(nations.size.tr().toLabel(Color.BLACK.cpy().apply { a = 0.7f }, 14).apply {
startingLocationIcons.add(nations.size.tr().toLabel(ImageGetter.CHARCOAL.cpy().apply { a = 0.7f }, 14).apply {
tileGroup.layerMisc.addActor(this)
setOrigin(Align.center)
center(tileGroup)

View File

@ -4,6 +4,7 @@ import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.Batch
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.badlogic.gdx.scenes.scene2d.utils.Drawable
import com.unciv.ui.images.ImageGetter
import com.unciv.ui.screens.basescreen.BaseScreen
/**
@ -22,7 +23,7 @@ open class BorderedTable(
* that parser still works!
*/
var bgColor: Color = Color.BLACK
var bgColor: Color = ImageGetter.CHARCOAL
var bgBorderColor: Color = Color.WHITE
var borderSize: Float = 5f

View File

@ -8,6 +8,7 @@ import com.badlogic.gdx.utils.Align
import com.unciv.Constants
import com.unciv.models.translations.tr
import com.unciv.ui.components.extensions.toLabel
import com.unciv.ui.images.ImageGetter
/**
* A widget containing two [Label]s superimposed with an offset to create a shadow effect.
@ -28,7 +29,7 @@ class ShadowedLabel(
text: String,
fontSize: Int = Constants.defaultFontSize,
labelColor: Color = Color.WHITE,
shadowColor: Color = Color.BLACK,
shadowColor: Color = ImageGetter.CHARCOAL,
hideIcons: Boolean = true,
shadowOffset: Float = 1f
) : Stack() {

View File

@ -27,6 +27,7 @@ import com.unciv.ui.components.extensions.toLabel
import com.unciv.ui.components.input.onClick
import com.unciv.ui.components.widgets.UncivSlider.Companion.formatPercent
import com.unciv.ui.images.IconCircleGroup
import com.unciv.ui.images.ImageGetter
import com.unciv.ui.screens.basescreen.BaseScreen
import kotlin.math.abs
import kotlin.math.sign
@ -155,7 +156,7 @@ class UncivSlider (
stepChanged() // Initialize tip formatting
if (plusMinus) {
minusButton = "-".toLabel(Color.BLACK, plusMinusFontSize)
minusButton = "-".toLabel(ImageGetter.CHARCOAL, plusMinusFontSize)
.apply { setAlignment(Align.center) }
.surroundWithCircle(plusMinusCircleSize)
minusButton.onClick {
@ -171,7 +172,7 @@ class UncivSlider (
if (plusMinus) {
if (vertical) row()
plusButton = "+".toLabel(Color.BLACK, plusMinusFontSize)
plusButton = "+".toLabel(ImageGetter.CHARCOAL, plusMinusFontSize)
.apply { setAlignment(Align.center) }
.surroundWithCircle(plusMinusCircleSize)
plusButton.onClick {

View File

@ -47,6 +47,7 @@ import kotlin.math.sqrt
object ImageGetter {
const val whiteDotLocation = "OtherIcons/whiteDot"
const val circleLocation = "OtherIcons/Circle"
val CHARCOAL = Color(0x333333FF)
// We use texture atlases to minimize texture swapping - see https://yairm210.medium.com/the-libgdx-performance-guide-1d068a84e181
lateinit var atlas: TextureAtlas
@ -254,7 +255,7 @@ object ImageGetter {
fun getRandomNationPortrait(size: Float): Portrait = PortraitNation(Constants.random, size)
fun getUnitIcon(unit: BaseUnit, color: Color = Color.BLACK): Image =
fun getUnitIcon(unit: BaseUnit, color: Color = CHARCOAL): Image =
if (imageExists("UnitIcons/${unit.name}"))
getImage("UnitIcons/${unit.name}").apply { this.color = color }
else getImage("UnitTypeIcons/${unit.type}").apply { this.color = color }
@ -430,12 +431,12 @@ object ImageGetter {
}
healthBar.add(healthPartOfBar).size(healthBarSize * healthPercent, height)
val emptyPartOfBar = getDot(Color.BLACK)
val emptyPartOfBar = getDot(CHARCOAL)
healthBar.add(emptyPartOfBar).size(healthBarSize * (1 - healthPercent), height)
healthBar.pad(1f)
healthBar.pack()
healthBar.background = BaseScreen.skinStrings.getUiBackground("General/HealthBar", tintColor = Color.BLACK)
healthBar.background = BaseScreen.skinStrings.getUiBackground("General/HealthBar", tintColor = CHARCOAL)
return healthBar
}

View File

@ -147,7 +147,7 @@ class PortraitResource(name: String, size: Float, amount: Int = 0) : Portrait(Ty
fontSize = 8,
fontColor = Color.WHITE,
alignment = Align.center)
val amountGroup = label.surroundWithCircle(size/2, true, Color.BLACK)
val amountGroup = label.surroundWithCircle(size/2, true, ImageGetter.CHARCOAL)
label.y -= 0.5f
amountGroup.x = width - amountGroup.width * 3 / 4
@ -164,7 +164,7 @@ class PortraitResource(name: String, size: Float, amount: Int = 0) : Portrait(Ty
class PortraitTech(name: String, size: Float) : Portrait(Type.Tech, name, size) {
override fun getDefaultOuterBackgroundTint(): Color = getDefaultImageTint()
override fun getDefaultImageTint(): Color =
ruleset.eras[ruleset.technologies[imageName]?.era()]?.getColor()?.darken(0.6f) ?: Color.BLACK
ruleset.eras[ruleset.technologies[imageName]?.era()]?.getColor()?.darken(0.6f) ?: ImageGetter.CHARCOAL
}
class PortraitUnit(name: String, size: Float) : Portrait(Type.Unit, name, size) {
@ -180,15 +180,15 @@ class PortraitUnavailableWonderForTechTree(name: String, size: Float) : Portrait
}
class PortraitUnique(name: String, size: Float) : Portrait(Type.Unique, name, size) {
override fun getDefaultImageTint(): Color = Color.BLACK
override fun getDefaultImageTint(): Color = ImageGetter.CHARCOAL
}
class PortraitReligion(name: String, size: Float) : Portrait(Type.Religion, name, size) {
override fun getDefaultImageTint(): Color = Color.BLACK
override fun getDefaultImageTint(): Color = ImageGetter.CHARCOAL
}
class PortraitUnitAction(name: String, size: Float) : Portrait(Type.UnitAction, name, size) {
override fun getDefaultImageTint(): Color = Color.BLACK
override fun getDefaultImageTint(): Color = ImageGetter.CHARCOAL
}
class PortraitImprovement(name: String, size: Float, dim: Boolean = false, isPillaged: Boolean = false) : Portrait(Type.Improvement, name, size) {
@ -236,7 +236,7 @@ class PortraitNation(name: String, size: Float) : Portrait(Type.Nation, name, si
}
override fun getDefaultInnerBackgroundTint(): Color =
ruleset.nations[imageName]?.getOuterColor() ?: Color.BLACK
ruleset.nations[imageName]?.getOuterColor() ?: ImageGetter.CHARCOAL
override fun getDefaultOuterBackgroundTint(): Color = getDefaultImageTint()
override fun getDefaultImageTint(): Color = ruleset.nations[imageName]?.getInnerColor() ?: Color.WHITE

View File

@ -30,7 +30,7 @@ import com.unciv.ui.screens.basescreen.BaseScreen
class AskNumberPopup(
screen: BaseScreen,
label: String = "Please enter a number",
icon: IconCircleGroup = ImageGetter.getImage("OtherIcons/Pencil").apply { this.color = Color.BLACK }.surroundWithCircle(80f),
icon: IconCircleGroup = ImageGetter.getImage("OtherIcons/Pencil").apply { this.color = ImageGetter.CHARCOAL }.surroundWithCircle(80f),
defaultValue: String = "",
amountButtons: List<Int> = listOf(),
bounds: IntRange = IntRange(Int.MIN_VALUE, Int.MAX_VALUE),

View File

@ -24,7 +24,7 @@ import com.unciv.ui.components.extensions.toLabel
class AskTextPopup(
screen: BaseScreen,
label: String = "Please enter some text",
icon: Group = ImageGetter.getImage("OtherIcons/Pencil").apply { this.color = Color.BLACK }.surroundWithCircle(80f),
icon: Group = ImageGetter.getImage("OtherIcons/Pencil").apply { this.color = ImageGetter.CHARCOAL }.surroundWithCircle(80f),
defaultText: String = "",
errorText: String = "Invalid input! Please enter a different string.",
maxLength: Int = 32,

View File

@ -120,7 +120,7 @@ class ModCheckTab(
else -> "OtherIcons/Checkmark"
}
val icon = ImageGetter.getImage(iconName)
.apply { color = Color.BLACK }
.apply { color = ImageGetter.CHARCOAL }
.surroundWithCircle(30f, color = iconColor)
val expanderTab = ExpanderTab(mod.name, icon = icon, startsOutOpened = mod.name in openedExpanderTitles) {

View File

@ -85,7 +85,7 @@ class UniqueTable(isMainUnique: Boolean, val ruleset: Ruleset, stage: Stage,
.filter { it.modifierType != UniqueTarget.ModifierType.None }
defaults().pad(10f)
background = ImageGetter.getWhiteDotDrawable().tint(Color.BLACK.cpy().apply { a=0.3f })
background = ImageGetter.getWhiteDotDrawable().tint(ImageGetter.CHARCOAL.cpy().apply { a=0.3f })
val uniqueTargetSelectBoxTable = Table().apply { defaults().pad(5f) }
uniqueTargetsSelectBox = SelectBox<UniqueTarget>(BaseScreen.skin)
uniqueTargetsSelectBox.setItems(uniqueTargets)

View File

@ -93,7 +93,7 @@ class CityConstructionsTable(private val cityScreen: CityScreen) {
constructionsQueueScrollPane.setOverscroll(false, false)
constructionsQueueTable.background = BaseScreen.skinStrings.getUiBackground(
"CityScreen/CityConstructionTable/ConstructionsQueueTable",
tintColor = Color.BLACK
tintColor = ImageGetter.CHARCOAL
)
upperTable.defaults().left().top()
@ -106,7 +106,7 @@ class CityConstructionsTable(private val cityScreen: CityScreen) {
availableConstructionsScrollPane.setOverscroll(false, false)
availableConstructionsTable.background = BaseScreen.skinStrings.getUiBackground(
"CityScreen/CityConstructionTable/AvailableConstructionsTable",
tintColor = Color.BLACK
tintColor = ImageGetter.CHARCOAL
)
lowerTableScrollCell = lowerTable.add(availableConstructionsScrollPane).bottom()
lowerTable.row()
@ -383,7 +383,7 @@ class CityConstructionsTable(private val cityScreen: CityScreen) {
else
BaseScreen.skinStrings.getUiBackground(
"CityScreen/CityConstructionTable/QueueEntry",
tintColor = Color.BLACK
tintColor = ImageGetter.CHARCOAL
)
}
@ -442,7 +442,7 @@ class CityConstructionsTable(private val cityScreen: CityScreen) {
if (!cannotAddConstructionToQueue(construction, cityScreen.city, cityScreen.city.cityConstructions)) {
val addToQueueButton = ImageGetter.getImage("OtherIcons/New")
.apply { color = Color.BLACK }.surroundWithCircle(40f)
.apply { color = ImageGetter.CHARCOAL }.surroundWithCircle(40f)
addToQueueButton.onClick(UncivSound.Silent) {
// Since the pickConstructionButton.onClick adds the construction if it's selected,
// this effectively adds the construction even if it's unselected
@ -502,7 +502,7 @@ class CityConstructionsTable(private val cityScreen: CityScreen) {
// Lazy because possibly not needed (highlight true, clearOthers false) and slightly costly
BaseScreen.skinStrings.getUiBackground(
"CityScreen/CityConstructionTable/PickConstructionButton",
tintColor = Color.BLACK
tintColor = ImageGetter.CHARCOAL
)
}
@ -585,7 +585,7 @@ class CityConstructionsTable(private val cityScreen: CityScreen) {
movePriority: (Int) -> Int
): Table {
val button = Table()
button.add(ImageGetter.getArrowImage(arrowDirection).apply { color = Color.BLACK }.surroundWithCircle(40f))
button.add(ImageGetter.getArrowImage(arrowDirection).apply { color = ImageGetter.CHARCOAL }.surroundWithCircle(40f))
button.touchable = Touchable.enabled
// Don't bind the queue reordering keys here - those should affect only the selected entry, not all of them
button.onActivation {

View File

@ -57,7 +57,7 @@ class CityStatsTable(private val cityScreen: CityScreen) : Table() {
innerTable.pad(5f)
innerTable.background = BaseScreen.skinStrings.getUiBackground(
"CityScreen/CityStatsTable/InnerTable",
tintColor = Color.BLACK.cpy().apply { a = 0.8f }
tintColor = ImageGetter.CHARCOAL.cpy().apply { a = 0.8f }
)
upperTable.defaults().pad(2f)
@ -388,7 +388,7 @@ class CityStatsTable(private val cityScreen: CityScreen) : Table() {
val percent = gppCurrent / gppNeeded.toFloat()
val progressBar = ImageGetter.ProgressBar(300f, 25f, false)
progressBar.setBackground(Color.BLACK.cpy().apply { a = 0.8f })
progressBar.setBackground(ImageGetter.CHARCOAL.cpy().apply { a = 0.8f })
progressBar.setProgress(Color.ORANGE, percent)
progressBar.apply {
val bar = ImageGetter.getWhiteDot()

View File

@ -83,7 +83,7 @@ class SpecialistAllocationTable(private val cityScreen: CityScreen) : Table(Base
private fun getAssignButton(assignedSpecialists: Int, maxSpecialists: Int, specialistName: String): Actor {
if (assignedSpecialists >= maxSpecialists || city.isPuppet) return Table()
val assignButton = "+".toLabel(Color.BLACK, Constants.headingFontSize)
val assignButton = "+".toLabel(ImageGetter.CHARCOAL, Constants.headingFontSize)
.apply { this.setAlignment(Align.center) }
.surroundWithCircle(30f).apply { circle.color = Color.GREEN.darken(0.2f) }
assignButton.onClick {
@ -98,7 +98,7 @@ class SpecialistAllocationTable(private val cityScreen: CityScreen) : Table(Base
}
private fun getUnassignButton(assignedSpecialists: Int, specialistName: String): Actor {
val unassignButton = "-".toLabel(Color.BLACK, Constants.headingFontSize)
val unassignButton = "-".toLabel(ImageGetter.CHARCOAL, Constants.headingFontSize)
.apply { this.setAlignment(Align.center) }
.surroundWithCircle(30f).apply { circle.color = Color.RED.darken(0.1f) }
unassignButton.onClick {

View File

@ -75,7 +75,7 @@ internal object CivilopediaImageGetters {
}.surroundWithCircle(size)
return null
}
return tryImage("$policyBranchIconFolder/$name", Color.BLACK)
return tryImage("$policyBranchIconFolder/$name", ImageGetter.CHARCOAL)
?: tryImage("$policyIconFolder/$name", Color.BROWN)
}
val resource = { name: String, size: Float ->

View File

@ -156,7 +156,7 @@ class DiplomacyScreen(
val innerColor = civ.gameInfo.ruleset.nations[civ.civName]!!.getInnerColor()
val typeIcon = ImageGetter.getImage("CityStateIcons/"+civ.cityStateType.name)
.surroundWithCircle(size = 35f, color = innerColor).apply {
actor.color = Color.BLACK
actor.color = ImageGetter.CHARCOAL
}
civIndicator.addActor(typeIcon)
typeIcon.y = floor(civIndicator.height - typeIcon.height)

View File

@ -514,7 +514,7 @@ private class RandomNationPickerPopup(
const val buttonsCircleSize = 70f
const val buttonsIconSize = 50f
const val buttonsOffsetFromEdge = 5f
val buttonsBackColor: Color = Color.BLACK.cpy().apply { a = 0.67f }
val buttonsBackColor: Color = ImageGetter.CHARCOAL.cpy().apply { a = 0.67f }
}
// This Popup's body has two halves of same size, either side by side or arranged vertically

View File

@ -45,7 +45,7 @@ internal class NationPickerPopup(
const val buttonsCircleSize = 70f
const val buttonsIconSize = 50f
const val buttonsOffsetFromEdge = 5f
val buttonsBackColor: Color = Color.BLACK.cpy().apply { a = 0.67f }
val buttonsBackColor: Color = ImageGetter.CHARCOAL.cpy().apply { a = 0.67f }
// Icon view sizing
const val iconViewIconSize = 50f // Portrait lies and will be bigger than asked for (55f)
const val iconViewCellSize = 60f // Difference to the above is used for selection highlight

View File

@ -225,9 +225,9 @@ class NewGameScreen(
scrollPane.setScrollingDisabled(true,true)
topTable.add("Game Options".toLabel(fontSize = Constants.headingFontSize)).pad(20f, 0f)
topTable.addSeparatorVertical(Color.BLACK, 1f)
topTable.addSeparatorVertical(ImageGetter.CHARCOAL, 1f)
topTable.add("Map Options".toLabel(fontSize = Constants.headingFontSize)).pad(20f,0f)
topTable.addSeparatorVertical(Color.BLACK, 1f)
topTable.addSeparatorVertical(ImageGetter.CHARCOAL, 1f)
topTable.add("Civilizations".toLabel(fontSize = Constants.headingFontSize)).pad(20f,0f)
topTable.addSeparator(Color.CLEAR, height = 1f)

View File

@ -100,7 +100,7 @@ class PlayerPickerTable(
}
if (!locked && gameParameters.players.size < gameBasics.nations.values.count { it.isMajorCiv }) {
val addPlayerButton = "+".toLabel(Color.BLACK, 30)
val addPlayerButton = "+".toLabel(ImageGetter.CHARCOAL, 30)
.apply { this.setAlignment(Align.center) }
.surroundWithCircle(50f)
.onClick {
@ -211,7 +211,7 @@ class PlayerPickerTable(
}
if (!locked) {
playerTable.add("-".toLabel(Color.BLACK, 30, Align.center)
playerTable.add("-".toLabel(ImageGetter.CHARCOAL, 30, Align.center)
.surroundWithCircle(40f)
.onClick {
gameParameters.players.remove(player)

View File

@ -38,7 +38,7 @@ enum class CityOverviewTabColumn : ISortableGridContentProvider<City, EmpireOver
override val defaultSort get() = SortableGrid.SortDirection.Ascending
override fun getComparator() = compareBy<City, String>(collator) { it.name.tr(hideIcons = true) }
override fun getHeaderActor(iconSize: Float) =
ImageGetter.getImage("UnitIcons/Settler").apply { color = Color.BLACK }
ImageGetter.getImage("UnitIcons/Settler").apply { color = ImageGetter.CHARCOAL }
.surroundWithCircle(iconSize)
override fun getEntryValue(item: City) = 0 // make sure that `stat!!` in the super isn't used
override fun getEntryActor(item: City, iconSize: Float, actionContext: EmpireOverviewScreen) =

View File

@ -61,7 +61,7 @@ class GlobalPoliticsOverviewTable(
defaults().pad(5f)
background = BaseScreen.skinStrings.getUiBackground(
"OverviewScreen/DiplomacyOverviewTab/CivTable",
tintColor = Color.BLACK
tintColor = ImageGetter.CHARCOAL
)
}
@ -532,7 +532,7 @@ class GlobalPoliticsOverviewTable(
legend.add(ShadowedLabel("Diagram line colors", Constants.headingFontSize)).colspan(2).row()
//todo Rethink hardcoding together with the statusLine.color one in DiplomacyGroup
legend.addLegendRow("War", Color.RED)
for (level in RelationshipLevel.values()) {
for (level in RelationshipLevel.entries) {
val lineColor = if (level == RelationshipLevel.Ally) Color.CYAN else level.color
legend.addLegendRow(level.name, lineColor)
}

View File

@ -1,16 +1,15 @@
package com.unciv.ui.screens.overviewscreen
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Touchable
import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.unciv.logic.civilization.Civilization
import com.unciv.logic.civilization.Notification
import com.unciv.logic.civilization.NotificationCategory
import com.unciv.models.translations.tr
import com.unciv.ui.components.extensions.toLabel
import com.unciv.ui.components.input.onClick
import com.unciv.ui.components.widgets.ColorMarkupLabel
import com.unciv.ui.components.widgets.TabbedPager
import com.unciv.ui.components.input.onClick
import com.unciv.ui.components.extensions.toLabel
import com.unciv.ui.images.ImageGetter
import com.unciv.ui.screens.basescreen.BaseScreen
@ -76,7 +75,7 @@ class NotificationsOverviewTable(
add(ImageGetter.getWhiteDot()).minHeight(2f).width(stageWidth / 4)
}).row()
for (category in NotificationCategory.values()) {
for (category in Notification.NotificationCategory.entries) {
val categoryNotifications = notifications.filter { it.category == category }
if (categoryNotifications.isEmpty()) continue
@ -86,7 +85,7 @@ class NotificationsOverviewTable(
for (notification in categoryNotifications) {
val notificationTable = Table(BaseScreen.skin)
val label = ColorMarkupLabel(notification.text, Color.BLACK, fontSize = 20)
val label = ColorMarkupLabel(notification.text, ImageGetter.CHARCOAL, fontSize = 20)
.apply { wrap = true }
notificationTable.add(label).width(stageWidth / 2 - iconSize * notification.icons.size)

View File

@ -1,6 +1,7 @@
package com.unciv.ui.screens.pickerscreens
import com.badlogic.gdx.graphics.Color
import com.unciv.ui.images.ImageGetter
/** Colours used on the [PromotionPickerScreen]
@ -8,7 +9,7 @@ import com.badlogic.gdx.graphics.Color
* These are backed by Skin.json
*/
class PromotionScreenColors {
val default: Color = Color.BLACK
val default: Color = ImageGetter.CHARCOAL
val selected: Color = Color(0.2824f, 0.5765f, 0.6863f, 1f) // colorFromRGB(72, 147, 175)
val pathToSelection: Color = Color(0.1882f, 0.3843f, 0.4575f, 1f) // selected.darken(0.33f)
val promoted: Color = Color(0.8f, 0.6745f, 0f, 1f) // colorFromRGB(255, 215, 0).darken(0.2f)

View File

@ -99,7 +99,7 @@ class ReligiousBeliefsPickerScreen (
}
val changeReligionNameButton = Button(
ImageGetter.getImage("OtherIcons/Pencil").apply { this.color = Color.BLACK }.surroundWithCircle(30f),
ImageGetter.getImage("OtherIcons/Pencil").apply { this.color = ImageGetter.CHARCOAL }.surroundWithCircle(30f),
skin
)

View File

@ -95,7 +95,7 @@ class TechButton(
techEnabledIcons.background = BaseScreen.skinStrings.getUiBackground(
"TechPickerScreen/TechButtonIconsOutline",
BaseScreen.skinStrings.roundedEdgeRectangleSmallShape,
tintColor = Color.BLACK.cpy().apply { a = 0.7f }
tintColor = ImageGetter.CHARCOAL.cpy().apply { a = 0.7f }
)
techEnabledIcons.pad(2f, 10f, 2f, 0f)
techEnabledIcons.defaults().padRight(5f)

View File

@ -152,7 +152,7 @@ class TechPickerScreen(
val color = when {
civTech.era.name == era -> queuedTechColor
ruleset.eras[era]!!.eraNumber < civTech.era.eraNumber -> colorFromRGB(255, 175, 0)
else -> Color.BLACK.cpy()
else -> ImageGetter.CHARCOAL.cpy()
}
val table1 = Table().pad(1f)
@ -213,7 +213,7 @@ class TechPickerScreen(
tempTechsToResearch.firstOrNull() == techName && !freeTechPick -> currentTechColor
researchableTechs.contains(techName) -> researchableTechColor
tempTechsToResearch.contains(techName) -> queuedTechColor
else -> Color.BLACK.cpy()
else -> ImageGetter.CHARCOAL.cpy()
})
if (isResearched && techName != Constants.futureTech) {

View File

@ -81,7 +81,7 @@ internal class VictoryScreenCivGroup(
civ.isDefeated() && defeatedPlayerStyle == DefeatedPlayerStyle.GREYED_OUT -> {
val icon = (ImageGetter.getImage("OtherIcons/DisbandUnit"))
icon.setSize(30f)
return Triple(icon, Color.LIGHT_GRAY, Color.BLACK)
return Triple(icon, Color.LIGHT_GRAY, ImageGetter.CHARCOAL)
}
currentPlayer.isSpectator()
|| civ.isDefeated() && defeatedPlayerStyle == DefeatedPlayerStyle.REGULAR
@ -92,7 +92,7 @@ internal class VictoryScreenCivGroup(
return Triple(ImageGetter.getNationPortrait(civ.nation, 30f), civ.nation.getOuterColor(), civ.nation.getInnerColor())
}
else ->
return Triple((ImageGetter.getRandomNationPortrait(30f)), Color.LIGHT_GRAY, Color.BLACK)
return Triple((ImageGetter.getRandomNationPortrait(30f)), Color.LIGHT_GRAY, ImageGetter.CHARCOAL)
}
}

View File

@ -301,7 +301,7 @@ class NotificationsScroll(
.minHeight(2f).width(minCategoryLineWidth)
add(Table().apply {
background = backgroundDrawable
val label = ColorMarkupLabel(category.name, Color.BLACK, fontSize = fontSize)
val label = ColorMarkupLabel(category.name, ImageGetter.CHARCOAL, fontSize = fontSize)
add(label)
captionWidth = prefWidth // of this wrapper including background rims
captionWidth
@ -348,7 +348,7 @@ class NotificationsScroll(
}
val maxLabelWidth = maxEntryWidth - (itemIconSize + 5f) * notification.icons.size - 10f
val label = WrappableLabel(notification.text, maxLabelWidth, Color.BLACK, labelFontSize, hideIcons = true)
val label = WrappableLabel(notification.text, maxLabelWidth, ImageGetter.CHARCOAL, labelFontSize, hideIcons = true)
label.setAlignment(Align.center)
if (label.prefWidth > maxLabelWidth * scaleFactor) { // can't explain why the comparison needs scaleFactor
label.wrap = true
@ -413,11 +413,11 @@ class NotificationsScroll(
.surroundWithCircle(restoreButtonSize, resizeActor = false)
size(restoreButtonSize)
countLabel = "".toLabel(Color.BLACK, restoreButtonNumberFontSize, Align.center)
countLabel = "".toLabel(ImageGetter.CHARCOAL, restoreButtonNumberFontSize, Align.center)
// not using surroundWithCircle for the count, as the centering will break if positioned within another IconCircleGroup (why?)
labelInnerCircle = ImageGetter.getCircle(Color.WHITE, restoreButtonNumbersSize * 0.9f)
labelInnerCircle.centerAtNumberPosition()
labelOuterCircle = ImageGetter.getCircle(Color.BLACK, restoreButtonNumbersSize)
labelOuterCircle = ImageGetter.getCircle(ImageGetter.CHARCOAL, restoreButtonNumbersSize)
labelOuterCircle.centerAtNumberPosition()
actor.addActor(labelOuterCircle)
actor.addActor(labelInnerCircle)

View File

@ -237,7 +237,7 @@ object BattleTableHelpers {
val damagedHealth = ImageGetter.getDot(Color.FIREBRICK)
if (UncivGame.Current.settings.continuousRendering) {
damagedHealth.addAction(Actions.forever(Actions.sequence(
Actions.color(Color.BLACK, 0.7f),
Actions.color(ImageGetter.CHARCOAL, 0.7f),
Actions.color(Color.FIREBRICK, 0.7f)
)))
}
@ -247,7 +247,7 @@ object BattleTableHelpers {
val remainingHealthDot = ImageGetter.getWhiteDot()
remainingHealthDot.color = Color.GREEN
addHealthToBar(ImageGetter.getDot(Color.BLACK), maxHealth - currentHealth)
addHealthToBar(ImageGetter.getDot(ImageGetter.CHARCOAL), maxHealth - currentHealth)
addHealthToBar(damagedHealth, currentHealth - maxRemainingHealth)
addHealthToBar(maybeDamagedHealth, maxRemainingHealth - minRemainingHealth)
addHealthToBar(remainingHealthDot, minRemainingHealth)

View File

@ -1,6 +1,5 @@
package com.unciv.ui.screens.worldscreen.minimap
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.ui.Image
import com.unciv.GUI
import com.unciv.ui.components.extensions.setSize
@ -30,7 +29,7 @@ class MapOverlayToggleButton(
resizeActor = false
) {
init {
circle.color = Color.BLACK
circle.color = ImageGetter.CHARCOAL
onClick(::toggle)
}

View File

@ -8,6 +8,7 @@ import com.unciv.models.Counter
import com.unciv.models.ruleset.BeliefType
import com.unciv.ui.components.extensions.disable
import com.unciv.ui.components.extensions.enable
import com.unciv.ui.images.ImageGetter
import com.unciv.ui.popups.ConfirmPopup
import com.unciv.ui.screens.cityscreen.CityScreen
import com.unciv.ui.screens.overviewscreen.EspionageOverviewScreen
@ -21,7 +22,7 @@ import com.unciv.utils.Concurrency
import com.unciv.utils.launchOnGLThread
enum class NextTurnAction(protected val text: String, val color: Color) {
Default("", Color.BLACK) {
Default("", ImageGetter.CHARCOAL) {
override val icon get() = null
override fun isChoice(worldScreen: WorldScreen) = false
},

View File

@ -253,7 +253,7 @@ class UnitTable(val worldScreen: WorldScreen) : Table() {
1 -> Color.BROWN
2 -> Color.LIGHT_GRAY
3 -> Color.GOLD
else -> Color.BLACK
else -> ImageGetter.CHARCOAL
}
repeat(spy.rank) {
val star = ImageGetter.getImage("OtherIcons/Star")
@ -280,7 +280,7 @@ class UnitTable(val worldScreen: WorldScreen) : Table() {
for (status in selectedUnit!!.statuses) {
val group = ImageGetter.getPromotionPortrait(status.name)
val turnsLeft = "${status.turnsLeft}${Fonts.turn}".toLabel(fontSize = 8).surroundWithCircle(15f, color = Color.BLACK)
val turnsLeft = "${status.turnsLeft}${Fonts.turn}".toLabel(fontSize = 8).surroundWithCircle(15f, color = ImageGetter.CHARCOAL)
group.addActor(turnsLeft)
turnsLeft.setPosition(group.width, 0f, Align.bottomRight)
promotionsTable.add(group).padBottom(2f)

View File

@ -42,10 +42,10 @@ class MoveHereOverlayButtonData(val unitToTurnsToDestination: HashMap<MapUnit, I
val image = if (isParadrop)
ImageGetter.getUnitActionPortrait("Paradrop", buttonSize / 2)
else ImageGetter.getStatIcon("Movement")
.apply { color = Color.BLACK; width = buttonSize / 2; height = buttonSize / 2 }
.apply { color = ImageGetter.CHARCOAL; width = buttonSize / 2; height = buttonSize / 2 }
val moveHereButton = image
.surroundWithCircle(buttonSize - 2, false)
.surroundWithCircle(buttonSize, false, Color.BLACK)
.surroundWithCircle(buttonSize, false, ImageGetter.CHARCOAL)
if (!isParadrop) {
val numberCircle = unitToTurnsToDestination.values.maxOrNull()!!.tr().toLabel(fontSize = 14)
@ -87,7 +87,7 @@ class SwapWithOverlayButtonData(val unit: MapUnit, val tile: Tile) : OverlayButt
swapWithButton.addActor(ImageGetter.getCircle(size = buttonSize))
swapWithButton.addActor(
ImageGetter.getImage("OtherIcons/Swap").apply {
color = Color.BLACK
color = ImageGetter.CHARCOAL
setSize(buttonSize / 2)
center(swapWithButton)
}
@ -163,7 +163,7 @@ class MoveSpyOverlayButtonData(val spy: Spy, val city: City?) : OverlayButtonDat
spyActionButton.addActor(
ImageGetter.getStatIcon("Movement").apply {
name = "Button"
color = Color.BLACK
color = ImageGetter.CHARCOAL
setSize(buttonSize / 2)
center(spyActionButton)
}