Added feature to change text colors via MCM
This commit is contained in:
1 parent
1fa60c6aaf
commit
47fb913db2
5 files changed
+134
-38
No files matched your search
+4
-24
@@ -664,40 +664,20 @@ end
|
||||
|
||||
-- Get KColor object of "Entity Name" texts
|
||||
function EID:getNameColor()
|
||||
return KColor(
|
||||
EID.Config["ItemNameColor"][1],
|
||||
EID.Config["ItemNameColor"][2],
|
||||
EID.Config["ItemNameColor"][3],
|
||||
EID.Config["Transparency"]
|
||||
)
|
||||
return EID:getColor(EID.Config["ItemNameColor"], EID.InlineColors["ColorEIDObjName"])
|
||||
end
|
||||
|
||||
-- Get KColor object of "Description" texts
|
||||
function EID:getTextColor()
|
||||
return KColor(
|
||||
EID.Config["TextColor"][1],
|
||||
EID.Config["TextColor"][2],
|
||||
EID.Config["TextColor"][3],
|
||||
EID.Config["Transparency"]
|
||||
)
|
||||
return EID:getColor(EID.Config["TextColor"], EID.InlineColors["ColorEIDText"])
|
||||
end
|
||||
|
||||
-- Get KColor object of "Transformation" texts
|
||||
function EID:getTransformationColor()
|
||||
return KColor(
|
||||
EID.Config["TransformationColor"][1],
|
||||
EID.Config["TransformationColor"][2],
|
||||
EID.Config["TransformationColor"][3],
|
||||
EID.Config["Transparency"]
|
||||
)
|
||||
return EID:getColor(EID.Config["TransformationColor"], EID.InlineColors["ColorEIDTransform"])
|
||||
end
|
||||
|
||||
-- Get KColor object of "Error" texts
|
||||
function EID:getErrorColor()
|
||||
return KColor(
|
||||
EID.Config["ErrorColor"][1],
|
||||
EID.Config["ErrorColor"][2],
|
||||
EID.Config["ErrorColor"][3],
|
||||
EID.Config["Transparency"]
|
||||
)
|
||||
return EID:getColor(EID.Config["ErrorColor"], EID.InlineColors["ColorEIDError"])
|
||||
end
|
||||
+12
-12
@@ -72,9 +72,9 @@ EID.DefaultConfig = {
|
||||
-- Toggle Display of Trinket descriptions
|
||||
-- Default = true
|
||||
["DisplayTrinketInfo"] = true,
|
||||
-- Set the RGB color of the Itemname text
|
||||
-- Default = {0.8, 0.3, 0.8}
|
||||
["ItemNameColor"] = {0.8, 0.3, 0.8},
|
||||
-- Set the color-name of the Itemname description text. Color names can be found& defined in "eid_data.lua"
|
||||
-- Default = "ColorEIDObjName"
|
||||
["ItemNameColor"] = "ColorEIDObjName",
|
||||
-------TRANSFORMATIONS---------
|
||||
|
||||
-- Toggle Display of Transformation text
|
||||
@@ -83,9 +83,9 @@ EID.DefaultConfig = {
|
||||
-- Toggle Display of Transformation icons
|
||||
-- Default = true
|
||||
["TransformationIcons"] = true,
|
||||
-- Set the RGB color of the Transformation text
|
||||
-- Default = { 0.5, 0.5, 1}
|
||||
["TransformationColor"] = {0.5, 0.5, 1},
|
||||
-- Set the color-name of the Transformation description text. Color names can be found& defined in "eid_data.lua"
|
||||
-- Default = "ColorEIDTransform"
|
||||
["TransformationColor"] = "ColorEIDTransform",
|
||||
------------CARDS--------------
|
||||
|
||||
-- Toggle Display of Card / Rune descriptions
|
||||
@@ -120,12 +120,12 @@ EID.DefaultConfig = {
|
||||
-- Error message displayed when an error occurs
|
||||
-- Default = [Effect not defined]
|
||||
["ErrorMessage"] = "[Effect not defined]",
|
||||
-- Set the RGB color of the default description text
|
||||
-- Default = { 1, 1, 1}
|
||||
["TextColor"] = {1, 1, 1},
|
||||
-- Set the RGB color of the Error text
|
||||
-- Default = { 1, 0, 0}
|
||||
["ErrorColor"] = {1, 0.4, 0.4},
|
||||
-- Set the color-name of the default description text. Color names can be found& defined in "eid_data.lua"
|
||||
-- Default = "ColorEIDText"
|
||||
["TextColor"] = "ColorEIDText",
|
||||
-- Set the color-name of the Error description text. Color names can be found& defined in "eid_data.lua"
|
||||
-- Default = "ColorEIDError"
|
||||
["ErrorColor"] = "ColorEIDError",
|
||||
-- Enables or disables custom Descriptions for entities
|
||||
-- Default = true
|
||||
["EnableEntityDescriptions"] = true
|
||||
|
||||
@@ -137,6 +137,10 @@ EID.InlineColors = {
|
||||
["ColorObjName"] = function(_) return EID:getNameColor() end,
|
||||
["ColorReset"] = function(_) return EID.LastRenderCallColor end,
|
||||
-- Basic Colors
|
||||
["ColorEIDText"] = KColor(1, 1, 1, 1),
|
||||
["ColorEIDTransform"] = KColor(0.5, 0.5, 1, 1),
|
||||
["ColorEIDError"] = KColor(1, 0.4, 0.4, 1),
|
||||
["ColorEIDObjName"] = KColor(0.8, 0.3, 0.8, 1),
|
||||
["ColorBlack"] = KColor(0, 0, 0, 1),
|
||||
["ColorWhite"] = KColor(1, 1, 1, 1),
|
||||
["ColorRed"] = KColor(1, 0, 0, 1),
|
||||
|
||||
@@ -7,7 +7,7 @@ local enableDebug = false
|
||||
|
||||
require("eid_config")
|
||||
EID.Config = EID.DefaultConfig
|
||||
EID.Config.Version = "3.0"
|
||||
EID.Config.Version = "3.1"
|
||||
EID.isHidden = EID.Config["Hidden"]
|
||||
|
||||
-- general variables
|
||||
|
||||
+113
-1
@@ -5,6 +5,7 @@ EID.MCMCompat_isDisplayingEIDTab = false
|
||||
local MCMCompat_isDisplayingDummyMCMObj = false
|
||||
local MCMCompat_oldPermanentObj = false
|
||||
EID.MCMLoaded = MCMLoaded
|
||||
local colorNameArray = {}
|
||||
|
||||
function EID:renderMCMDummyDescription()
|
||||
if MCMLoaded then
|
||||
@@ -17,6 +18,7 @@ function EID:renderMCMDummyDescription()
|
||||
demoDescObj.Description = "A very cool description as a demonstration of the power of EID!#\1 This is also a cool line#This line loves you {{Heart}}"
|
||||
EID:displayPermanentText(demoDescObj)
|
||||
MCMCompat_isDisplayingDummyMCMObj = true
|
||||
EID:buildColorArray()
|
||||
elseif not MCM.IsVisible and MCMCompat_isDisplayingDummyMCMObj then
|
||||
if MCMCompat_oldPermanentObj == nil then
|
||||
EID:hidePermanentText()
|
||||
@@ -26,10 +28,21 @@ function EID:renderMCMDummyDescription()
|
||||
EID.MCMCompat_isDisplayingEIDTab = false
|
||||
MCMCompat_oldPermanentObj = nil
|
||||
MCMCompat_isDisplayingDummyMCMObj = false
|
||||
colorNameArray = {}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function EID:buildColorArray()
|
||||
colorNameArray = {}
|
||||
for k,v in pairs(EID.InlineColors) do
|
||||
if k~="ColorText" and k~="ColorTransform" and k~="ColorError" and k~="ColorObjName" and k~="ColorReset" then
|
||||
table.insert(colorNameArray,k)
|
||||
end
|
||||
end
|
||||
table.sort(colorNameArray)
|
||||
end
|
||||
|
||||
if MCMLoaded then
|
||||
function AnIndexOf(t, val)
|
||||
for k, v in ipairs(t) do
|
||||
@@ -64,6 +77,7 @@ if MCMLoaded then
|
||||
Minimum = 1,
|
||||
Maximum = #(EID.Languages),
|
||||
Display = function()
|
||||
EID.MCMCompat_isDisplayingEIDTab = false;
|
||||
return "Language: " .. displayLanguage[AnIndexOf(EID.Languages, EID.Config["Language"])]
|
||||
end,
|
||||
OnChange = function(currentNum)
|
||||
@@ -200,6 +214,7 @@ if MCMLoaded then
|
||||
return EID.Config["DisplayItemInfo"]
|
||||
end,
|
||||
Display = function()
|
||||
EID.MCMCompat_isDisplayingEIDTab = false;
|
||||
local onOff = "False"
|
||||
if EID.Config["DisplayItemInfo"] then
|
||||
onOff = "True"
|
||||
@@ -383,6 +398,7 @@ if MCMLoaded then
|
||||
Minimum = 1,
|
||||
Maximum = #fontTypes,
|
||||
Display = function()
|
||||
EID.MCMCompat_isDisplayingEIDTab = true;
|
||||
return "Font Type: " .. EID.Config["FontType"]
|
||||
end,
|
||||
OnChange = function(currentNum)
|
||||
@@ -405,7 +421,6 @@ if MCMLoaded then
|
||||
Minimum = 1,
|
||||
Maximum = 6,
|
||||
Display = function()
|
||||
EID.MCMCompat_isDisplayingEIDTab = true;
|
||||
return "Text Size: " .. EID.Config["Scale"]
|
||||
end,
|
||||
OnChange = function(currentNum)
|
||||
@@ -520,6 +535,7 @@ if MCMLoaded then
|
||||
end
|
||||
}
|
||||
)
|
||||
-------TRANSFORMATION ICON---------
|
||||
MCM.AddSetting(
|
||||
"EID",
|
||||
"Visuals",
|
||||
@@ -540,4 +556,100 @@ if MCMLoaded then
|
||||
end
|
||||
}
|
||||
)
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
---------------------------------Visuals-----------------------------------
|
||||
|
||||
-- Text Color
|
||||
MCM.AddSetting(
|
||||
"EID",
|
||||
"Colors",
|
||||
{
|
||||
Type = ModConfigMenuOptionType.NUMBER,
|
||||
CurrentSetting = function()
|
||||
return AnIndexOf(colorNameArray, EID.Config["TextColor"])
|
||||
end,
|
||||
Minimum = 0,
|
||||
Maximum = 1000,
|
||||
Display = function()
|
||||
EID.MCMCompat_isDisplayingEIDTab = true;
|
||||
return "Descriptions: " .. string.gsub(EID.Config["TextColor"], "Color", "").. " ("..AnIndexOf(colorNameArray, EID.Config["TextColor"]).."/"..#colorNameArray..")"
|
||||
end,
|
||||
OnChange = function(currentNum)
|
||||
if currentNum == 0 then currentNum = #colorNameArray end
|
||||
if currentNum > #colorNameArray then currentNum = 1 end
|
||||
EID.Config["TextColor"] = colorNameArray[currentNum]
|
||||
end,
|
||||
Info = {"Changes the color of normal texts."}
|
||||
}
|
||||
)
|
||||
-- Name Color
|
||||
MCM.AddSetting(
|
||||
"EID",
|
||||
"Colors",
|
||||
{
|
||||
Type = ModConfigMenuOptionType.NUMBER,
|
||||
CurrentSetting = function()
|
||||
return AnIndexOf(colorNameArray, EID.Config["ItemNameColor"])
|
||||
end,
|
||||
Minimum = 0,
|
||||
Maximum = 1000,
|
||||
Display = function()
|
||||
EID.MCMCompat_isDisplayingEIDTab = true;
|
||||
return "Names: " .. string.gsub(EID.Config["ItemNameColor"], "Color", "").. " ("..AnIndexOf(colorNameArray, EID.Config["ItemNameColor"]).."/"..#colorNameArray..")"
|
||||
end,
|
||||
OnChange = function(currentNum)
|
||||
if currentNum == 0 then currentNum = #colorNameArray end
|
||||
if currentNum > #colorNameArray then currentNum = 1 end
|
||||
EID.Config["ItemNameColor"] = colorNameArray[currentNum]
|
||||
end,
|
||||
Info = {"Changes the color of name texts."}
|
||||
}
|
||||
)
|
||||
-- Transform Color
|
||||
MCM.AddSetting(
|
||||
"EID",
|
||||
"Colors",
|
||||
{
|
||||
Type = ModConfigMenuOptionType.NUMBER,
|
||||
CurrentSetting = function()
|
||||
return AnIndexOf(colorNameArray, EID.Config["TransformationColor"])
|
||||
end,
|
||||
Minimum = 0,
|
||||
Maximum = 1000,
|
||||
Display = function()
|
||||
EID.MCMCompat_isDisplayingEIDTab = true;
|
||||
return "Transformations: " .. string.gsub(EID.Config["TransformationColor"], "Color", "").. " ("..AnIndexOf(colorNameArray, EID.Config["TransformationColor"]).."/"..#colorNameArray..")"
|
||||
end,
|
||||
OnChange = function(currentNum)
|
||||
if currentNum == 0 then currentNum = #colorNameArray end
|
||||
if currentNum > #colorNameArray then currentNum = 1 end
|
||||
EID.Config["TransformationColor"] = colorNameArray[currentNum]
|
||||
end,
|
||||
Info = {"Changes the color of transformation texts."}
|
||||
}
|
||||
)
|
||||
-- Error Color
|
||||
MCM.AddSetting(
|
||||
"EID",
|
||||
"Colors",
|
||||
{
|
||||
Type = ModConfigMenuOptionType.NUMBER,
|
||||
CurrentSetting = function()
|
||||
return AnIndexOf(colorNameArray, EID.Config["ErrorColor"])
|
||||
end,
|
||||
Minimum = 0,
|
||||
Maximum = 1000,
|
||||
Display = function()
|
||||
EID.MCMCompat_isDisplayingEIDTab = true;
|
||||
return "Errors: " .. string.gsub(EID.Config["ErrorColor"], "Color", "").. " ("..AnIndexOf(colorNameArray, EID.Config["ErrorColor"]).."/"..#colorNameArray..")"
|
||||
end,
|
||||
OnChange = function(currentNum)
|
||||
if currentNum == 0 then currentNum = #colorNameArray end
|
||||
if currentNum > #colorNameArray then currentNum = 1 end
|
||||
EID.Config["ErrorColor"] = colorNameArray[currentNum]
|
||||
end,
|
||||
Info = {"Changes the color of error messages like Unknown pills"}
|
||||
}
|
||||
)
|
||||
end
|
||||
Reference in new issue
Block a user