bmos
October 2nd, 2020, 04:50
EDIT: See post #3 (https://www.fantasygrounds.com/forums/showthread.php?62418-Matching-Sidebar-Icon-to-Multiple-Themes&p=546610&viewfull=1#post546610) for photoshop resource files (https://github.com/bmos/FG-PFRPG-Disease-Tracker/tree/master/graphics/resources/themesupport) to create your alternate sidebar icons with. Use the code here to make it all happen in one ext file.
I have an extension that adds an additional sidebar icon and had been adding the icon with:
aSBOverrides = {
-- CoreRPG overrides
["disease"] = {
bExport = true,
aDataMap = { "disease", "reference.diseases" },
aDisplayIcon = { "button_diseases", "button_diseases_down" },
sRecordDisplayClass = "referencedisease",
aGMListButtons = { "button_feat_type" };
aPlayerListButtons = { "button_feat_type" };
aCustomFilters = {
["Type"] = { sField = "type" },
},
},
};
function onInit()
for kRecordType,vRecordType in pairs(aSBOverrides) do
LibraryData.setRecordTypeInfo(kRecordType, vRecordType)
end
end
This evening, I realized that I could change onInit() to this which allows the icon match multiple themes:
function onInit()
if StringManager.contains(Extension.getExtensions(), 'Theme_SWU') then
aSBOverrides['disease']['aDisplayIcon'] = { 'SWU_light_button_diseases', 'SWU_light_button_diseases_down' }
elseif StringManager.contains(Extension.getExtensions(), 'Theme_SWU_dark') then
aSBOverrides['disease']['aDisplayIcon'] = { 'SWU_dark_button_diseases', 'SWU_dark_button_diseases_down' }
elseif StringManager.contains(Extension.getExtensions(), 'Theme_Simple_Brown') then
aSBOverrides['disease']['aDisplayIcon'] = { 'simplebrown_button_diseases', 'simplebrown_button_diseases_down' }
elseif StringManager.contains(Extension.getExtensions(), 'Theme_Simple_Gray') then
aSBOverrides['disease']['aDisplayIcon'] = { 'simplegray_button_diseases', 'simplegray_button_diseases_down' }
elseif StringManager.contains(Extension.getExtensions(), 'Theme_Simple_Dark_102') or StringManager.contains(Extension.getExtensions(), 'Theme_Simple_Dark_03') then
aSBOverrides['disease']['aDisplayIcon'] = { 'simpledark_button_diseases', 'simpledark_button_diseases_down' }
end
end
At that point it just comes down to making/including more icons. If only I had the artistic skill to draw goblins to match the Pathfinder theme icon...
Hopefully this is useful to others, un-themed assets has been the worst part of using custom themes (at least for me) and I haven't ever seen this approach used.
I have an extension that adds an additional sidebar icon and had been adding the icon with:
aSBOverrides = {
-- CoreRPG overrides
["disease"] = {
bExport = true,
aDataMap = { "disease", "reference.diseases" },
aDisplayIcon = { "button_diseases", "button_diseases_down" },
sRecordDisplayClass = "referencedisease",
aGMListButtons = { "button_feat_type" };
aPlayerListButtons = { "button_feat_type" };
aCustomFilters = {
["Type"] = { sField = "type" },
},
},
};
function onInit()
for kRecordType,vRecordType in pairs(aSBOverrides) do
LibraryData.setRecordTypeInfo(kRecordType, vRecordType)
end
end
This evening, I realized that I could change onInit() to this which allows the icon match multiple themes:
function onInit()
if StringManager.contains(Extension.getExtensions(), 'Theme_SWU') then
aSBOverrides['disease']['aDisplayIcon'] = { 'SWU_light_button_diseases', 'SWU_light_button_diseases_down' }
elseif StringManager.contains(Extension.getExtensions(), 'Theme_SWU_dark') then
aSBOverrides['disease']['aDisplayIcon'] = { 'SWU_dark_button_diseases', 'SWU_dark_button_diseases_down' }
elseif StringManager.contains(Extension.getExtensions(), 'Theme_Simple_Brown') then
aSBOverrides['disease']['aDisplayIcon'] = { 'simplebrown_button_diseases', 'simplebrown_button_diseases_down' }
elseif StringManager.contains(Extension.getExtensions(), 'Theme_Simple_Gray') then
aSBOverrides['disease']['aDisplayIcon'] = { 'simplegray_button_diseases', 'simplegray_button_diseases_down' }
elseif StringManager.contains(Extension.getExtensions(), 'Theme_Simple_Dark_102') or StringManager.contains(Extension.getExtensions(), 'Theme_Simple_Dark_03') then
aSBOverrides['disease']['aDisplayIcon'] = { 'simpledark_button_diseases', 'simpledark_button_diseases_down' }
end
end
At that point it just comes down to making/including more icons. If only I had the artistic skill to draw goblins to match the Pathfinder theme icon...
Hopefully this is useful to others, un-themed assets has been the worst part of using custom themes (at least for me) and I haven't ever seen this approach used.