1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 var EXPORTED_SYMBOLS = ["ThemeVariableMap", "ThemeContentPropertyList"];
7 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
9 const ThemeVariableMap = [
11 "--lwt-accent-color-inactive",
13 lwtProperty: "accentcolorInactive",
17 "--lwt-background-alignment",
20 lwtProperty: "backgroundsAlignment",
24 "--lwt-background-tiling",
27 lwtProperty: "backgroundsTiling",
33 lwtProperty: "tab_loading",
34 optionalElementID: "tabbrowser-tabs",
40 lwtProperty: "tab_text",
44 "--lwt-tab-line-color",
46 lwtProperty: "tab_line",
47 optionalElementID: "TabsToolbar",
51 "--lwt-background-tab-separator-color",
53 lwtProperty: "tab_background_separator",
59 lwtProperty: "toolbarColor",
65 lwtProperty: "toolbar_text",
69 "--lwt-tabs-border-color",
71 lwtProperty: "toolbar_top_separator",
72 optionalElementID: "navigator-toolbox",
76 "--toolbarseparator-color",
78 lwtProperty: "toolbar_vertical_separator",
82 "--chrome-content-separator-color",
84 lwtProperty: "toolbar_bottom_separator",
88 "--toolbarbutton-icon-fill",
90 lwtProperty: "icon_color",
94 "--lwt-toolbarbutton-icon-fill-attention",
96 lwtProperty: "icon_attention_color",
100 "--toolbarbutton-hover-background",
102 lwtProperty: "button_background_hover",
106 "--toolbarbutton-active-background",
108 lwtProperty: "button_background_active",
112 "--lwt-selected-tab-background-color",
114 lwtProperty: "tab_selected",
118 "--autocomplete-popup-highlight-background",
120 lwtProperty: "popup_highlight",
124 "--autocomplete-popup-highlight-color",
126 lwtProperty: "popup_highlight_text",
130 "--sidebar-background-color",
132 lwtProperty: "sidebar",
133 optionalElementID: "sidebar-box",
134 processColor(rgbaChannels, element) {
136 element.removeAttribute("lwt-sidebar");
139 const { r, g, b } = rgbaChannels;
140 element.setAttribute("lwt-sidebar", "true");
141 // Drop alpha channel
142 return `rgb(${r}, ${g}, ${b})`;
147 "--sidebar-text-color",
149 lwtProperty: "sidebar_text",
150 optionalElementID: "sidebar-box",
154 "--sidebar-border-color",
156 lwtProperty: "sidebar_border",
157 optionalElementID: "browser",
161 "--tabpanel-background-color",
163 lwtProperty: "ntp_background",
164 processColor(rgbaChannels) {
167 !Services.prefs.getBoolPref("browser.newtabpage.enabled")
169 // We only set the tabpanel background to the new tab background color
170 // if the user uses about:home for new tabs. Otherwise, we flash a
171 // colorful background when a new tab is opened. We will flash the
172 // newtab color in new windows if the user uses about:home for new
173 // tabs but not new windows. However, the flash is concealed by the OS
174 // window-open animation.
177 // Drop alpha channel
178 let { r, g, b } = rgbaChannels;
179 return `rgb(${r}, ${g}, ${b})`;
185 const ThemeContentPropertyList = [
187 "ntp_card_background",
191 "sidebar_highlight_text",