From 76d479f23c93c5663546221ab53faa313f21987a Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Sun, 18 Sep 2022 20:04:01 +0900 Subject: [PATCH] Fix: Proton Color - Page accent color at windows #469 --- __tests__/accent_color.test.scss | 24 ++++++++++++++++++++++++ css/leptonContent.css | 11 +++++++---- src/contents/_proton_color.scss | 9 +++++---- src/utils/_accent_color.scss | 12 +++++++++--- 4 files changed, 45 insertions(+), 11 deletions(-) diff --git a/__tests__/accent_color.test.scss b/__tests__/accent_color.test.scss index fe22ef83..206760ed 100644 --- a/__tests__/accent_color.test.scss +++ b/__tests__/accent_color.test.scss @@ -59,4 +59,28 @@ } } } + @include test("Highlight") { + @include assert { + @include output { + @include AccentColor("Highlight") { + body { + background-color: $accentColor; + color: $accentTextColor; + } + } + } + @include expect { + body { + background-color: AccentColor; + color: AccentColorText; + } + @supports -moz-bool-pref("userChrome.compatibility.accent_color") { + body { + background-color: Highlight; + color: HighlightText; + } + } + } + } + } } diff --git a/css/leptonContent.css b/css/leptonContent.css index a451ead5..30e337e2 100644 --- a/css/leptonContent.css +++ b/css/leptonContent.css @@ -827,14 +827,17 @@ :host, :root { --in-content-primary-button-text-color: AccentColorText !important; - --in-content-primary-button-background: Highlight !important; - --in-content-primary-button-background-hover: color-mix(in srgb, black 10%, Highlight) !important; - --in-content-primary-button-background-active: color-mix(in srgb, black 20%, Highlight) !important; + --in-content-primary-button-background: AccentColor !important; + --in-content-primary-button-background-hover: color-mix(in srgb, black 10%, AccentColor) !important; + --in-content-primary-button-background-active: color-mix(in srgb, black 20%, AccentColor) !important; } @supports -moz-bool-pref("userChrome.compatibility.accent_color") { :host, :root { - --in-content-primary-button-text-color: -moz-accent-color-foreground !important; + --in-content-primary-button-text-color: HighlightText !important; + --in-content-primary-button-background: Highlight !important; + --in-content-primary-button-background-hover: color-mix(in srgb, black 10%, Highlight) !important; + --in-content-primary-button-background-active: color-mix(in srgb, black 20%, Highlight) !important; } } } diff --git a/src/contents/_proton_color.scss b/src/contents/_proton_color.scss index ab1fc389..61a7ab8d 100644 --- a/src/contents/_proton_color.scss +++ b/src/contents/_proton_color.scss @@ -19,12 +19,13 @@ @include Option("userContent.page.proton_color.system_accent") { :host, :root { - @include AccentColor { + @include AccentColor("Highlight") { --in-content-primary-button-text-color: #{$accentTextColor} !important; + + --in-content-primary-button-background: #{$accentColor} !important; + --in-content-primary-button-background-hover: color-mix(in srgb, black 10%, #{$accentColor}) !important; + --in-content-primary-button-background-active: color-mix(in srgb, black 20%, #{$accentColor}) !important; } - --in-content-primary-button-background: Highlight !important; - --in-content-primary-button-background-hover: color-mix(in srgb, black 10%, Highlight) !important; - --in-content-primary-button-background-active: color-mix(in srgb, black 20%, Highlight) !important; } } } diff --git a/src/utils/_accent_color.scss b/src/utils/_accent_color.scss index 03742e58..9da9896c 100644 --- a/src/utils/_accent_color.scss +++ b/src/utils/_accent_color.scss @@ -7,12 +7,18 @@ $accentColor: AccentColor; $accentTextColor: AccentColorText; -@mixin AccentColor() { +@mixin AccentColor($mode: "-moz-accent-color") { @content; @include Option("userChrome.compatibility.accent_color") { - $accentColor: -moz-accent-color !global; - $accentTextColor: -moz-accent-color-foreground !global; + @if $mode == "Highlight" { + $accentColor: Highlight !global; + $accentTextColor: HighlightText !global; + } + @else { + $accentColor: -moz-accent-color !global; + $accentTextColor: -moz-accent-color-foreground !global; + } @content; }