tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ThemeVariableMap.sys.mjs (3568B)


      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/. */
      4 
      5 export const ThemeVariableMap = [
      6  [
      7    "--lwt-accent-color-inactive",
      8    {
      9      lwtProperty: "accentcolorInactive",
     10    },
     11  ],
     12  [
     13    "--lwt-background-alignment",
     14    {
     15      isColor: false,
     16      lwtProperty: "backgroundsAlignment",
     17    },
     18  ],
     19  [
     20    "--lwt-background-tiling",
     21    {
     22      isColor: false,
     23      lwtProperty: "backgroundsTiling",
     24    },
     25  ],
     26  [
     27    "--tab-loading-fill",
     28    {
     29      lwtProperty: "tab_loading",
     30    },
     31  ],
     32  [
     33    "--tab-selected-bgcolor",
     34    {
     35      lwtProperty: "tab_selected",
     36    },
     37  ],
     38  [
     39    "--tab-selected-textcolor",
     40    {
     41      lwtProperty: "tab_text",
     42    },
     43  ],
     44  [
     45    "--lwt-tab-line-color",
     46    {
     47      lwtProperty: "tab_line",
     48    },
     49  ],
     50  [
     51    "--lwt-background-tab-separator-color",
     52    {
     53      lwtProperty: "tab_background_separator",
     54    },
     55  ],
     56  [
     57    "--tabs-navbar-separator-color",
     58    {
     59      lwtProperty: "toolbar_top_separator",
     60    },
     61  ],
     62  [
     63    "--tabs-navbar-separator-style",
     64    {
     65      lwtProperty: "toolbar_top_separator",
     66      processColor(rgbaChannels) {
     67        // If the separator is transparent, we don't want it to take space.
     68        return rgbaChannels?.a === 0 ? "none" : null;
     69      },
     70    },
     71  ],
     72  [
     73    "--toolbarseparator-color",
     74    {
     75      lwtProperty: "toolbar_vertical_separator",
     76    },
     77  ],
     78  [
     79    "--chrome-content-separator-color",
     80    {
     81      lwtProperty: "toolbar_bottom_separator",
     82    },
     83  ],
     84  [
     85    "--toolbarbutton-hover-background",
     86    {
     87      lwtProperty: "button_background_hover",
     88    },
     89  ],
     90  [
     91    "--toolbarbutton-active-background",
     92    {
     93      lwtProperty: "button_background_active",
     94    },
     95  ],
     96  [
     97    "--urlbarView-highlight-background",
     98    {
     99      lwtProperty: "popup_highlight",
    100    },
    101  ],
    102  [
    103    "--urlbarView-highlight-color",
    104    {
    105      lwtProperty: "popup_highlight_text",
    106    },
    107  ],
    108  [
    109    "--sidebar-background-color",
    110    {
    111      lwtProperty: "sidebar",
    112      processColor(rgbaChannels) {
    113        if (!rgbaChannels) {
    114          return null;
    115        }
    116        const { r, g, b } = rgbaChannels;
    117        // Drop alpha channel
    118        return `rgb(${r}, ${g}, ${b})`;
    119      },
    120    },
    121  ],
    122  [
    123    "--sidebar-text-color",
    124    {
    125      lwtProperty: "sidebar_text",
    126    },
    127  ],
    128  [
    129    "--sidebar-border-color",
    130    {
    131      lwtProperty: "sidebar_border",
    132    },
    133  ],
    134  [
    135    "--tabpanel-background-color",
    136    {
    137      lwtProperty: "ntp_background",
    138      processColor(rgbaChannels) {
    139        if (
    140          !rgbaChannels ||
    141          !Services.prefs.getBoolPref("browser.newtabpage.enabled")
    142        ) {
    143          // We only set the tabpanel background to the new tab background color
    144          // if the user uses about:home for new tabs. Otherwise, we flash a
    145          // colorful background when a new tab is opened. We will flash the
    146          // newtab color in new windows if the user uses about:home for new
    147          // tabs but not new windows. However, the flash is concealed by the OS
    148          // window-open animation.
    149          return null;
    150        }
    151        // Drop alpha channel
    152        let { r, g, b } = rgbaChannels;
    153        return `rgb(${r}, ${g}, ${b})`;
    154      },
    155    },
    156  ],
    157 ];
    158 
    159 export const ThemeContentPropertyList = [
    160  "ntp_background",
    161  "ntp_card_background",
    162  "ntp_text",
    163  "sidebar",
    164  "sidebar_highlight",
    165  "sidebar_highlight_text",
    166  "sidebar_text",
    167  "zap_gradient",
    168  "ai_gradient",
    169 ];