I need to know ID of current active Firefox Persona in order to get the textcolor value from users.pref to be able to display different icons on my widget, because I don’t wont to display blue icon on blue background.
This tutorial shows:
-
How to access Addon Manager from a JetPack script
-
How to get all Addons based on their type [extension, theme, locale, multipackage]
-
How to get Active Persona’s ID
It’s a lot for such short script, isn’t it?
//we need this component
const {Cu} = require("chrome");
//import AddonManager
var AddonManager = Cu.import("resource://gre/modules/AddonManager.jsm")
.AddonManager;
//We need to get all Addons that are with type 'theme'
var types =['theme'];
//get all themes
var currentTheme = AddonManager
.getAddonsByTypes(types,function(addons){
//Firefox always shows active theme as 0 element (not sure, need confirmation)
//get the ID of the active theme/persona
var tid=addons[0].id.toString();
//show it in console
console.log("Current Id:"+ tid);
});
Unfortunatelly textcolor value is not part of the object (yet) and the only way to find it is to check with this id (tid) in prefs.js
Leave a Reply