Bug 1695345 - Fork Dark Mode compact theme for Proton. r=mixedpuppy

Differential Revision: https://phabricator.services.mozilla.com/D106691
This commit is contained in:
Mike Conley 2021-03-02 04:36:57 +00:00
Родитель d9229f3d5b
Коммит 1e1fa52a31
6 изменённых файлов: 106 добавлений и 0 удалений

Просмотреть файл

@ -1366,6 +1366,35 @@ BrowserGlue.prototype = {
"1.1",
"resource://builtin-themes/dark/"
);
if (
AppConstants.NIGHTLY_BUILD &&
Services.prefs.getBoolPref("browser.proton.enabled", false)
) {
// Temporarily install a fork of the Dark Theme to do development on for
// Proton. We only make this available if `browser.proton.enabled` is set
// to true, and we make sure to uninstall it again during shutdown.
const kProtonDarkThemeID = "firefox-compact-proton-dark@mozilla.org";
AddonManager.maybeInstallBuiltinAddon(
kProtonDarkThemeID,
"1.0",
"resource://builtin-themes/proton-dark/"
);
AsyncShutdown.profileChangeTeardown.addBlocker(
"Uninstall Proton Dark Mode",
async () => {
try {
let addon = await AddonManager.getAddonByID(kProtonDarkThemeID);
await addon.uninstall();
} catch (e) {
Cu.reportError(
"Failed to uninstall firefox-compact-proton-dark on shutdown"
);
}
}
);
}
AddonManager.maybeInstallBuiltinAddon(
"firefox-alpenglow@mozilla.org",
"1.2",

Просмотреть файл

@ -12,6 +12,10 @@ browser.jar:
content/builtin-themes/dark (dark/*.css)
content/builtin-themes/dark/manifest.json (dark/manifest.json)
content/builtin-themes/proton-dark (proton-dark/*.svg)
content/builtin-themes/proton-dark (proton-dark/*.css)
content/builtin-themes/proton-dark/manifest.json (proton-dark/manifest.json)
content/builtin-themes/light (light/*.svg)
content/builtin-themes/light (light/*.css)
content/builtin-themes/light/manifest.json (light/manifest.json)

Просмотреть файл

@ -0,0 +1,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* Proton Dark theme */
@import url("chrome://browser/skin/compacttheme.css");

Просмотреть файл

@ -0,0 +1,13 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
<path fill="#1C1B22" d="M2 2h14v13H2z"/>
<path fill="#2B2A33" d="M16 2v13H2v15h28V2H16z"/>
<rect x="1" y="1" width="30" height="30" rx="2" ry="2" fill="none" stroke="#08091a" stroke-opacity=".35" stroke-width="2"/>
<circle cx="9.5" cy="22.5" r="6" fill="#474749" stroke="#08091a"/>
<path d="M12.5 22H7.707l2.146-2.146a.5.5 0 0 0-.707-.707l-3 3a.5.5 0 0 0 0 .708l3 3a.5.5 0 1 0 .707-.707L7.707 23H12.5a.5.5 0 0 0 0-1z" fill="#f9f9fa" fill-opacity=".8"/>
<path d="M20.5 20h4a.5.5 0 0 0 0-1h-4a.5.5 0 0 0 0 1zm4 2h-4a.5.5 0 0 0 0 1h4a.5.5 0 0 0 0-1zm0 3h-4a.5.5 0 0 0 0 1h4a.5.5 0 0 0 0-1z" fill="#f9f9fa" fill-opacity=".8"/>
<path fill="#0a84ff" d="M16 2h14v1H16z"/>
<path fill="#08091a" d="M15 2v12H2v1h14V2h-1z"/>
</svg>

После

Ширина:  |  Высота:  |  Размер: 1.0 KiB

Просмотреть файл

@ -0,0 +1,43 @@
{
"manifest_version": 2,
"applications": {
"gecko": {
"id": "firefox-compact-proton-dark@mozilla.org"
}
},
"name": "Proton Dark",
"description": "A theme with a dark color scheme.",
"author": "Mozilla",
"version": "1.1",
"icons": {"32": "icon.svg"},
"theme": {
"colors": {
"tab_background_text": "rgb(249, 249, 250)",
"icons": "rgb(249, 249, 250, 0.7)",
"frame": "hsl(240, 5%, 5%)",
"popup": "#4a4a4f",
"popup_text": "rgb(249, 249, 250)",
"popup_border": "#27272b",
"tab_line": "#0a84ff",
"toolbar": "hsl(240, 1%, 20%)",
"toolbar_bottom_separator": "hsl(240, 5%, 5%)",
"toolbar_field": "rgb(71, 71, 73)",
"toolbar_field_border": "rgba(249, 249, 250, 0.2)",
"toolbar_field_separator": "#5F6670",
"toolbar_field_text": "rgb(249, 249, 250)",
"ntp_background": "#2A2A2E",
"ntp_text": "rgb(249, 249, 250)",
"sidebar": "#38383D",
"sidebar_text": "rgb(249, 249, 250)",
"sidebar_border": "rgba(255, 255, 255, 0.1)"
}
},
"theme_experiment": {
"stylesheet": "experiment.css"
}
}

Просмотреть файл

@ -13,6 +13,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
AddonManager: "resource://gre/modules/AddonManager.jsm",
AddonRepository: "resource://gre/modules/addons/AddonRepository.jsm",
AMTelemetry: "resource://gre/modules/AddonManager.jsm",
AppConstants: "resource://gre/modules/AppConstants.jsm",
ClientID: "resource://gre/modules/ClientID.jsm",
DeferredTask: "resource://gre/modules/DeferredTask.jsm",
E10SUtils: "resource://gre/modules/E10SUtils.jsm",
@ -103,6 +104,16 @@ const BUILTIN_THEME_PREVIEWS = new Map([
],
]);
if (
AppConstants.NIGHTLY_BUILD &&
Services.prefs.getBoolPref("browser.proton.enabled", false)
) {
BUILTIN_THEME_PREVIEWS.set(
"firefox-compact-proton-dark@mozilla.org",
"chrome://mozapps/content/extensions/firefox-compact-dark.svg"
);
}
const PERMISSION_MASKS = {
"ask-to-activate": AddonManager.PERM_CAN_ASK_TO_ACTIVATE,
enable: AddonManager.PERM_CAN_ENABLE,