mirror of
https://github.com/electron/electron.git
synced 2026-01-08 23:18:06 -05:00
feat: enable resetting accent color (#48274)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user