Skip to content

Commit

Permalink
Fixed inactive tab color is unreadable with accent color
Browse files Browse the repository at this point in the history
fix brave/brave-browser#22027

As we don't use accent color for title bar, tab color should not be
affected also by accent color.
Fixed by preventing Windows' accent color affect frame colors.
  • Loading branch information
simonhong committed Apr 8, 2022
1 parent e63386c commit 4e12b3a
Showing 1 changed file with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* Copyright (c) 2022 The Brave Authors. All rights reserved.
* 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/. */

#include "base/callback_list.h"
#include "base/no_destructor.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/color/win/accent_color_observer.h"

namespace ui {

class FakeAccentColorObserver {
public:
static FakeAccentColorObserver* Get() {
static base::NoDestructor<FakeAccentColorObserver> observer;
return observer.get();
}

FakeAccentColorObserver() {}
FakeAccentColorObserver(const FakeAccentColorObserver&) = delete;
FakeAccentColorObserver& operator=(const FakeAccentColorObserver&) = delete;
~FakeAccentColorObserver() {}

base::CallbackListSubscription Subscribe(base::RepeatingClosure callback) {
return callbacks_.Add(std::move(callback));
}

absl::optional<SkColor> accent_color() const { return absl::nullopt; }
absl::optional<SkColor> accent_color_inactive() const {
return absl::nullopt;
}
absl::optional<SkColor> accent_border_color() const { return absl::nullopt; }

private:
base::RepeatingClosureList callbacks_;
};

} // namespace ui

#define AccentColorObserver FakeAccentColorObserver
#include "src/chrome/browser/ui/color/win/native_chrome_color_mixer_win.cc"
#undef AccentColorObserver

0 comments on commit 4e12b3a

Please sign in to comment.