feat: enable resetting accent color (#48274)

This commit is contained in:
Shelley Vohr
2025-10-21 16:49:08 +02:00
committed by GitHub
parent 6562d6ed0b
commit 0a19176917
4 changed files with 43 additions and 12 deletions

View File

@@ -39,6 +39,7 @@
#endif
#if BUILDFLAG(IS_WIN)
#include <variant>
#include "shell/browser/ui/views/win_frame_view.h"
#include "shell/browser/ui/win/taskbar_host.h"
#include "ui/base/win/shell.h"
@@ -1100,6 +1101,12 @@ void BaseWindow::SetAccentColor(gin::Arguments* const args) {
v8::Local<v8::Value> ac_val;
args->GetNext(&ac_val);
if (!ac_val.IsEmpty() && ac_val->IsNull()) {
window_->SetAccentColor(std::monostate{});
window_->UpdateWindowAccentColor(window_->IsActive());
return;
}
if (!ac_val.IsEmpty() && ac_val->IsBoolean()) {
const bool ac_flag = ac_val->BooleanValue(args->isolate());
window_->SetAccentColor(ac_flag);
@@ -1118,7 +1125,7 @@ void BaseWindow::SetAccentColor(gin::Arguments* const args) {
}
args->ThrowTypeError(
"Invalid accent color value - must be a string or boolean");
"Invalid accent color value - must be null, hex string, or boolean");
}
v8::Local<v8::Value> BaseWindow::GetAccentColor() const {