PDA

View Full Version : Matching Sidebar Icon to Multiple Themes



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.

superteddy57
October 2nd, 2020, 13:33
Nice find bmos. Keep up the good work!

bmos
October 2nd, 2020, 21:14
For those who would like to adopt this approach as well, these Photoshop files (https://github.com/bmos/FG-PFRPG-Disease-Tracker/tree/master/graphics/resources/themesupport) should make it especially easy to add support for Simple Dark (https://github.com/bmos/FG-PFRPG-Disease-Tracker/blob/master/graphics/resources/themesupport/simpledark_button_diseases.psd), Simple Gray (https://github.com/bmos/FG-PFRPG-Disease-Tracker/blob/master/graphics/resources/themesupport/simplegray_button_diseases.psd), Simple Brown (https://github.com/bmos/FG-PFRPG-Disease-Tracker/blob/master/graphics/resources/themesupport/simplebrown_button_diseases.psd), Unity Light (https://github.com/bmos/FG-PFRPG-Disease-Tracker/blob/master/graphics/resources/themesupport/SWU_light_button_diseases.psd) and Unity Dark (https://github.com/bmos/FG-PFRPG-Disease-Tracker/blob/master/graphics/resources/themesupport/SWU_dark_button_diseases.psd) themes :)

EDIT: if you don't have photoshop and want to use these, let me know. I can export the various pieces as individual PNGs and then you can reassemble in your editor of choice.