mirror of
https://github.com/black7375/Firefox-UI-Fix.git
synced 2025-12-06 02:30:54 -08:00
Clean: SASS - Dark mixin
This commit is contained in:
parent
7a80769986
commit
abfe9027fa
11 changed files with 82 additions and 9 deletions
42
__tests__/darkmode.test.scss
Normal file
42
__tests__/darkmode.test.scss
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
@use 'true' as *;
|
||||||
|
@use "../src/utils/darkmode";
|
||||||
|
|
||||||
|
@include test-module("Color scheme is dark [mx]") {
|
||||||
|
@include test("simple") {
|
||||||
|
@include assert {
|
||||||
|
@include output {
|
||||||
|
@include darkmode.Dark {
|
||||||
|
body {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@include expect {
|
||||||
|
@media (-moz-toolbar-prefers-color-scheme: dark), (prefers-color-scheme: dark) {
|
||||||
|
body {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@include test("simple reversed") {
|
||||||
|
@include assert {
|
||||||
|
@include output {
|
||||||
|
body {
|
||||||
|
@include darkmode.Dark {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@include expect {
|
||||||
|
@media (-moz-toolbar-prefers-color-scheme: dark), (prefers-color-scheme: dark) {
|
||||||
|
body {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
23
__tests__/option.test.scss
Normal file
23
__tests__/option.test.scss
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
@use 'true' as *;
|
||||||
|
@use "../src/utils/option";
|
||||||
|
|
||||||
|
@include test-module("If exist pref [mx]") {
|
||||||
|
@include test("simple") {
|
||||||
|
@include assert {
|
||||||
|
@include output {
|
||||||
|
@include option.Option("userChrome.tab.photon") {
|
||||||
|
body {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@include expect {
|
||||||
|
@supports -moz-bool-pref("userChrome.tab.photon") {
|
||||||
|
body {
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
@media (-moz-toolbar-prefers-color-scheme: dark), (prefers-color-scheme: dark) {
|
@include Dark {
|
||||||
@import "dark_mode/addons_org";
|
@import "dark_mode/addons_org";
|
||||||
@import "dark_mode/support_org";
|
@import "dark_mode/support_org";
|
||||||
@import "dark_mode/accounts_com";
|
@import "dark_mode/accounts_com";
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
--organizer-pane-field-border-color: color-mix(in srgb, currentColor 41%, transparent);
|
--organizer-pane-field-border-color: color-mix(in srgb, currentColor 41%, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (-moz-toolbar-prefers-color-scheme: dark), (prefers-color-scheme: dark) {
|
@include Dark {
|
||||||
:root {
|
:root {
|
||||||
--organizer-color: rgb(251, 251, 254);
|
--organizer-color: rgb(251, 251, 254);
|
||||||
--organizer-deemphasized-color: rgb(191, 191, 201);
|
--organizer-deemphasized-color: rgb(191, 191, 201);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ browser[type="content"] > html {
|
||||||
--menu-border-color: #cfcfd8;
|
--menu-border-color: #cfcfd8;
|
||||||
--menuitem-hover-background-color: #e0e0e6;
|
--menuitem-hover-background-color: #e0e0e6;
|
||||||
}
|
}
|
||||||
@media (-moz-toolbar-prefers-color-scheme: dark), (prefers-color-scheme: dark) {
|
@include Dark {
|
||||||
:root {
|
:root {
|
||||||
--menu-border-color: rgba(107, 107, 107, 0.3);
|
--menu-border-color: rgba(107, 107, 107, 0.3);
|
||||||
--menu-color: #fbfbfe;
|
--menu-color: #fbfbfe;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
url("chrome://browser/content/pageinfo/pageInfo.xhtml")
|
url("chrome://browser/content/pageinfo/pageInfo.xhtml")
|
||||||
{
|
{
|
||||||
/*- Overwrite --------------------------------------------------------------*/
|
/*- Overwrite --------------------------------------------------------------*/
|
||||||
@media (-moz-toolbar-prefers-color-scheme: dark), (prefers-color-scheme: dark) {
|
@include Dark {
|
||||||
:root {
|
:root {
|
||||||
--in-content-page-background: #42414d;
|
--in-content-page-background: #42414d;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@
|
||||||
|
|
||||||
--panelview-toolbarbutton-focus-box-shadow: inset 0 0 0 2px var(--focus-outline-color) !important;
|
--panelview-toolbarbutton-focus-box-shadow: inset 0 0 0 2px var(--focus-outline-color) !important;
|
||||||
}
|
}
|
||||||
@media (-moz-toolbar-prefers-color-scheme: dark), (prefers-color-scheme: dark) {
|
@include Dark {
|
||||||
:root:not(:-moz-lwtheme),
|
:root:not(:-moz-lwtheme),
|
||||||
:root[lwt-default-theme-in-dark-mode] {
|
:root[lwt-default-theme-in-dark-mode] {
|
||||||
--mac-field-bgcolor: Field;
|
--mac-field-bgcolor: Field;
|
||||||
|
|
@ -206,7 +206,7 @@
|
||||||
--sidebar-text-color: var(--mac-text-color) !important;
|
--sidebar-text-color: var(--mac-text-color) !important;
|
||||||
/* --sidebar-border-color: var(--win-sidebar-border-color) !important; */
|
/* --sidebar-border-color: var(--win-sidebar-border-color) !important; */
|
||||||
}
|
}
|
||||||
@media (-moz-toolbar-prefers-color-scheme: dark), (prefers-color-scheme: dark) {
|
@include Dark {
|
||||||
.sidebar-panel[style="--newtab-background-color: rgba(43, 42, 51, 1); --newtab-text-primary-color: rgba(251, 251, 254, 1); --lwt-sidebar-background-color: rgb(56, 56, 61); --lwt-sidebar-text-color: rgba(249, 249, 250, 1);"],
|
.sidebar-panel[style="--newtab-background-color: rgba(43, 42, 51, 1); --newtab-text-primary-color: rgba(251, 251, 254, 1); --lwt-sidebar-background-color: rgb(56, 56, 61); --lwt-sidebar-text-color: rgba(249, 249, 250, 1);"],
|
||||||
body[lwt-sidebar][style="--newtab-background-color: rgba(43, 42, 51, 1); --newtab-text-primary-color: rgba(251, 251, 254, 1); --lwt-sidebar-background-color: rgb(56, 56, 61); --lwt-sidebar-text-color: rgba(249, 249, 250, 1);"],
|
body[lwt-sidebar][style="--newtab-background-color: rgba(43, 42, 51, 1); --newtab-text-primary-color: rgba(251, 251, 254, 1); --lwt-sidebar-background-color: rgb(56, 56, 61); --lwt-sidebar-text-color: rgba(249, 249, 250, 1);"],
|
||||||
.sidebar-panel[style="--newtab-background-color: rgb(43, 42, 51); --newtab-text-primary-color: rgba(251, 251, 254, 1); --lwt-sidebar-background-color: rgb(56, 56, 61); --lwt-sidebar-text-color: rgba(249, 249, 250, 1);"], /* Nightly */
|
.sidebar-panel[style="--newtab-background-color: rgb(43, 42, 51); --newtab-text-primary-color: rgba(251, 251, 254, 1); --lwt-sidebar-background-color: rgb(56, 56, 61); --lwt-sidebar-text-color: rgba(249, 249, 250, 1);"], /* Nightly */
|
||||||
|
|
@ -224,7 +224,7 @@
|
||||||
|
|
||||||
/*- Others -----------------------------------------------------------------*/
|
/*- Others -----------------------------------------------------------------*/
|
||||||
/* For Overwrite */
|
/* For Overwrite */
|
||||||
@media (-moz-toolbar-prefers-color-scheme: dark), (prefers-color-scheme: dark) {
|
@include Dark {
|
||||||
:root[lwt-default-theme-in-dark-mode][lwthemetextcolor="bright"] {
|
:root[lwt-default-theme-in-dark-mode][lwthemetextcolor="bright"] {
|
||||||
--toolbar-bgcolor: color-mix(in srgb, rgb(255, 255, 255) 15%, -moz-dialog) !important;
|
--toolbar-bgcolor: color-mix(in srgb, rgb(255, 255, 255) 15%, -moz-dialog) !important;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
--win-accent-hover-color: color-mix(in srgb, rgba(255, 255, 255, 0.8) 27%, -moz-accent-color);
|
--win-accent-hover-color: color-mix(in srgb, rgba(255, 255, 255, 0.8) 27%, -moz-accent-color);
|
||||||
--win-accent-active-color: -moz-accent-color;
|
--win-accent-active-color: -moz-accent-color;
|
||||||
}
|
}
|
||||||
@media (-moz-toolbar-prefers-color-scheme: dark), (prefers-color-scheme: dark) {
|
@include Dark {
|
||||||
:root:not(:-moz-lwtheme),
|
:root:not(:-moz-lwtheme),
|
||||||
:root[lwt-default-theme-in-dark-mode] {
|
:root[lwt-default-theme-in-dark-mode] {
|
||||||
--win-text-color: #ffffff;
|
--win-text-color: #ffffff;
|
||||||
|
|
@ -232,7 +232,7 @@
|
||||||
--sidebar-text-color: var(--win-text-color) !important;
|
--sidebar-text-color: var(--win-text-color) !important;
|
||||||
--sidebar-border-color: var(--win-border-color) !important;
|
--sidebar-border-color: var(--win-border-color) !important;
|
||||||
}
|
}
|
||||||
@media (-moz-toolbar-prefers-color-scheme: dark), (prefers-color-scheme: dark) {
|
@include Dark {
|
||||||
.sidebar-panel[style="--newtab-background-color: rgba(43, 42, 51, 1); --newtab-text-primary-color: rgba(251, 251, 254, 1); --lwt-sidebar-background-color: rgb(56, 56, 61); --lwt-sidebar-text-color: rgba(249, 249, 250, 1);"],
|
.sidebar-panel[style="--newtab-background-color: rgba(43, 42, 51, 1); --newtab-text-primary-color: rgba(251, 251, 254, 1); --lwt-sidebar-background-color: rgb(56, 56, 61); --lwt-sidebar-text-color: rgba(249, 249, 250, 1);"],
|
||||||
body[lwt-sidebar][style="--newtab-background-color: rgba(43, 42, 51, 1); --newtab-text-primary-color: rgba(251, 251, 254, 1); --lwt-sidebar-background-color: rgb(56, 56, 61); --lwt-sidebar-text-color: rgba(249, 249, 250, 1);"],
|
body[lwt-sidebar][style="--newtab-background-color: rgba(43, 42, 51, 1); --newtab-text-primary-color: rgba(251, 251, 254, 1); --lwt-sidebar-background-color: rgb(56, 56, 61); --lwt-sidebar-text-color: rgba(249, 249, 250, 1);"],
|
||||||
.sidebar-panel[style="--newtab-background-color: rgb(43, 42, 51); --newtab-text-primary-color: rgba(251, 251, 254, 1); --lwt-sidebar-background-color: rgb(56, 56, 61); --lwt-sidebar-text-color: rgba(249, 249, 250, 1);"], /* Nightly */
|
.sidebar-panel[style="--newtab-background-color: rgb(43, 42, 51); --newtab-text-primary-color: rgba(251, 251, 254, 1); --lwt-sidebar-background-color: rgb(56, 56, 61); --lwt-sidebar-text-color: rgba(249, 249, 250, 1);"], /* Nightly */
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
@use "utils/os" as *;
|
@use "utils/os" as *;
|
||||||
@use "utils/option" as *;
|
@use "utils/option" as *;
|
||||||
|
@use "utils/darkmode" as *;
|
||||||
|
|
||||||
@namespace xul "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
@namespace xul "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||||
@namespace html "http://www.w3.org/1999/xhtml";
|
@namespace html "http://www.w3.org/1999/xhtml";
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
@use "utils/os" as *;
|
@use "utils/os" as *;
|
||||||
|
@use "utils/darkmode" as *;
|
||||||
|
|
||||||
@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||||
@namespace html url("http://www.w3.org/1999/xhtml");
|
@namespace html url("http://www.w3.org/1999/xhtml");
|
||||||
|
|
|
||||||
6
src/utils/_darkmode.scss
Normal file
6
src/utils/_darkmode.scss
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
@mixin Dark() {
|
||||||
|
// -moz-toolbar-prefers-color-scheme is removed at v95, #250
|
||||||
|
@media (-moz-toolbar-prefers-color-scheme: dark), (prefers-color-scheme: dark) {
|
||||||
|
@content;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue