Add an in-out boolean color-scheme property to Palette (#4701)

This allows applications to force dark/light mode, as well as determine
which mode is active.
This commit is contained in:
Simon Hausmann 2024-03-26 15:44:22 +01:00 committed by GitHub
parent ccc92e6143
commit 68083243b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
48 changed files with 234 additions and 139 deletions

View file

@ -3080,8 +3080,8 @@ fn compile_builtin_function_call(
a = a.next().unwrap(),
)
}
BuiltinFunction::DarkColorScheme => {
format!("{}.dark_color_scheme()", access_window_field(ctx))
BuiltinFunction::ColorScheme => {
format!("{}.color_scheme()", access_window_field(ctx))
}
BuiltinFunction::SetTextInputFocused => {
format!("{}.set_text_input_focused({})", access_window_field(ctx), a.next().unwrap())

View file

@ -2538,9 +2538,9 @@ fn compile_builtin_function_call(
sp::Color::from_argb_u8(a, r, g, b)
})
}
BuiltinFunction::DarkColorScheme => {
BuiltinFunction::ColorScheme => {
let window_adapter_tokens = access_window_adapter_field(ctx);
quote!(sp::WindowInner::from_pub(#window_adapter_tokens.window()).dark_color_scheme())
quote!(sp::WindowInner::from_pub(#window_adapter_tokens.window()).color_scheme())
}
BuiltinFunction::TextInputFocused => {
let window_adapter_tokens = access_window_adapter_field(ctx);