mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Controls now respect OS and Chrome themes by default for both Alloy and Chrome runtimes. Chrome themes (mode and colors) can be configured using the new CefRequestContext::SetChromeColorScheme method. Individual theme colors can be overridden using the new CefWindowDelegate:: OnThemeColorsChanged and CefWindow::SetThemeColor methods. The `--force-light-mode` and `--force-dark-mode` command-line flags are now respected on all platforms as an override for the OS theme. The current Chrome theme, if any, will take precedence over the OS theme when determining light/dark status. On Windows and MacOS the titlebar color will also be updated to match the light/dark theme. Testable as follows: - Run: `cefclient --enable-chrome-runtime` OR `cefclient --use-views --persist-user-preferences --cache-path=...` - App launches with default OS light/dark theme colors. - Change OS dark/light theme under system settings. Notice that theme colors change as expected. - Right click, select items from the new Theme sub-menu. Notice that theme colors behave as expected. - Exit and relaunch the app. Notice that the last-used theme colors are applied on app restart. - Add `--background-color=green` to above command-line. - Perform the same actions as above. Notice that all controls start and remain green throughout (except some icons with Chrome runtime). - Add `--force-light-mode` or `--force-dark-mode` to above command-line. - Perform the same actions as above. Notice that OS dark/light theme changes are ignored, but Chrome theme changes work as expected.
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=3c4cb278397e9a07c8e5754650fe6944dd2a20ed$
|
||||
// $hash=4e2f75d68d804ad2414eb34b9f273b8f558c3dab$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/views/button_cpptoc.h"
|
||||
@ -950,6 +950,26 @@ cef_color_t CEF_CALLBACK button_get_background_color(struct _cef_view_t* self) {
|
||||
return _retval;
|
||||
}
|
||||
|
||||
cef_color_t CEF_CALLBACK button_get_theme_color(struct _cef_view_t* self,
|
||||
int color_id) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Execute
|
||||
cef_color_t _retval =
|
||||
CefButtonCppToC::Get(reinterpret_cast<cef_button_t*>(self))
|
||||
->GetThemeColor(color_id);
|
||||
|
||||
// Return type: simple
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK button_convert_point_to_screen(struct _cef_view_t* self,
|
||||
cef_point_t* point) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
@ -1212,6 +1232,7 @@ CefButtonCppToC::CefButtonCppToC() {
|
||||
GetStruct()->base.request_focus = button_request_focus;
|
||||
GetStruct()->base.set_background_color = button_set_background_color;
|
||||
GetStruct()->base.get_background_color = button_get_background_color;
|
||||
GetStruct()->base.get_theme_color = button_get_theme_color;
|
||||
GetStruct()->base.convert_point_to_screen = button_convert_point_to_screen;
|
||||
GetStruct()->base.convert_point_from_screen =
|
||||
button_convert_point_from_screen;
|
||||
|
Reference in New Issue
Block a user