简体   繁体   中英

How can I override skin's settings through code?

I have a Firefox extension that changes a browser's tab color like this:

tabBrowser.tabContainer.childNodes[i].style.backgroundColor = "#8f8";

This code works fine in my development profile, but in the working profile I have a theme installed (Noia 2.0 eXtreme), that sets its own appearance for the tabs, so my code can not change the tab's color. Is it possible to override the theme's settings through the code?

I just do not get it. I have found the skin's CSS file, it seems pretty simple.

tab {
    -moz-appearance: none;
    padding: 1px 5px 2px 7px;
    border-top: 1px  solid;
    border-right: 2px solid;
    border-left: 1px solid;
    -moz-border-top-colors: #FFFFFF;
    -moz-border-right-colors: #808080 #404040;
    -moz-border-left-colors: #FFFFFF;
    -moz-border-radius-topleft: 8px;
    -moz-border-radius-topright: 8px;
    background-color: #CDCED3;
    color: #606060;
    min-height: 20px !important
}
tab[selected="true"] {
    margin-top: 0;
    padding: 1px 7px 4px 9px;
    font-weight: bold;
    background-image : url("chrome://browser/skin/icons/Bookmark-background.png") !important;
    border-bottom: 1px solid;
    -moz-border-bottom-colors: #FFFFFF;
    color: #000000;
}
tab:hover {
    color: #000000 !important;
}

Setting

tabBrowser.tabContainer.childNodes[i].style.setProperty("background-image", "none", "important");

根据https://developer.mozilla.org/en/DOM/CSSStyleDeclaration你可以使用:

tabBrowser.tabContainer.childNodes[i].style.setProperty("background-color", "#8f8", "important");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM