Skip to content

Commit

Permalink
Fix: Proton Color - Page accent color at windows #469
Browse files Browse the repository at this point in the history
  • Loading branch information
black7375 committed Sep 18, 2022
1 parent 9fd8594 commit 76d479f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 11 deletions.
24 changes: 24 additions & 0 deletions __tests__/accent_color.test.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}
}
}
11 changes: 7 additions & 4 deletions css/leptonContent.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions src/contents/_proton_color.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
12 changes: 9 additions & 3 deletions src/utils/_accent_color.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 76d479f

Please sign in to comment.