Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Colors Version 1 #36

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions mods/BetterColors/hook/lua/ui/game/construction.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
do
local countColor = import("/mods/BetterColors/modules/Options.lua").countColor:Raw()
local OldCommonLogic = CommonLogic
function CommonLogic()
OldCommonLogic()
local CreateElement = controls.choices.CreateElement
controls.choices.CreateElement = function()
local btn = CreateElement()
btn.Count:SetColor(countColor)
return btn
end
local SetControlToType = controls.choices.SetControlToType
controls.choices.SetControlToType = function(control, type)
SetControlToType(control, type)
if type == 'unitstack' and not table.empty(control.Data.units) then
control.Count:SetColor(countColor)
end
end
end
end
7 changes: 7 additions & 0 deletions mods/BetterColors/hook/lua/ui/game/gamemain.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
do
local OldCreateUI = CreateUI
function CreateUI(isReplay)
OldCreateUI(isReplay)
import('/mods/BetterColors/modules/Options.lua').Init()
end
end
17 changes: 17 additions & 0 deletions mods/BetterColors/mod_info.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name = "Better Colors"
version = 1
copyright = ""
description = ""
author = "4z0t"
url = ""
uid = "better-colors-v01"
--icon = "/mods/BetterColors/icon.png"
selectable = true
enabled = true
exclusive = false
ui_only = true
requires = {}
requiresNames = {}
conflicts = {}
before = {}
after = {}
13 changes: 13 additions & 0 deletions mods/BetterColors/modules/Options.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
local Options = UMT.Options
local OptionVar = UMT.OptionVar.Create

local name = "BetterColors"
countColor = OptionVar(name, "countColor", 'ffffffff')

function Init()
Options.AddOptions(name, "Better Colors",
{
Options.ColorSlider("Units count color", countColor, 4)
}
)
end