Skip to content

A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.

Black theme: opaque black popups and quick search

kvxshenyjbetxn79ef1e87d312
diff --git a/crates/rf-app/src/quick_search.rs b/crates/rf-app/src/quick_search.rs
index 8db08ab0..307f4e84 100644
--- a/crates/rf-app/src/quick_search.rs
+++ b/crates/rf-app/src/quick_search.rs
@@ -1022,8 +1022,12 @@ pub fn toggle(cx: &mut App) {
match cx.open_window(opts, move |window, cx| {
let hwnd = crate::look::window::hwnd_of(window);
rf_win::window::set_dark_mode(hwnd, Palette::for_window(window).dark);
- if !glassy && crate::theme::cleartype_solid() {
+ if !glassy && (crate::theme::cleartype_solid() || crate::theme::black_popups()) {
rf_win::window::set_rounded_no_border(hwnd);
+ if crate::theme::black_popups() {
+ // black on black needs an edge: the palette's border (white at 14%) over black
+ rf_win::window::set_border_color(hwnd, 0x0024_2424);
+ }
}
crate::glass::keep_out_of_capture(hwnd);
// summoned from another app: take the keyboard (the hotkey press allows it)
diff --git a/crates/rf-app/src/theme.rs b/crates/rf-app/src/theme.rs
index 42614220..80a2d1b8 100644
--- a/crates/rf-app/src/theme.rs
+++ b/crates/rf-app/src/theme.rs
@@ -284,8 +284,16 @@ pub fn cleartype_solid() -> bool {
crate::settings::solid_cleartype() && crate::settings::solid_backdrop()
}
+/// Whether the Black (OLED) theme is chosen: its non-glass popups are opaque and pure black instead of Acrylic or grey.
+pub fn black_popups() -> bool {
+ crate::settings::theme_override() == crate::settings::ThemePref::Black
+}
+
/// What an opaque popup paints behind its content: the colour Windows 11 uses for a flyout without transparency.
pub fn cleartype_popup_fill(p: &Palette) -> Option<Hsla> {
+ if black_popups() {
+ return Some(p.window_bg);
+ }
cleartype_solid().then(|| if p.dark { hex(0x2C2C2C) } else { hex(0xF9F9F9) })
}
@@ -301,12 +309,18 @@ pub fn main_window_material(wanted: WindowBackgroundAppearance) -> WindowBackgro
/// The material of a popup (a menu, a flyout, a drop-down list): real glass when it was opened from a window that shows glass,
/// else Windows' Acrylic, else none (and then [`popup_fill`] is its surface).
pub fn popup_material(liquid: bool) -> WindowBackgroundAppearance {
+ if !liquid && black_popups() {
+ return WindowBackgroundAppearance::Opaque;
+ }
if liquid { WindowBackgroundAppearance::Transparent } else { window_material(WindowBackgroundAppearance::Blurred) }
}
/// What a popup paints behind its content on a Windows that gives it no Acrylic: the plain colour Windows 11 itself uses for a
/// flyout without transparency. `None` where the Acrylic is the surface and the popup paints nothing.
pub fn popup_fill(p: &Palette) -> Option<Hsla> {
+ if black_popups() {
+ return Some(p.window_bg);
+ }
(!crate::settings::materials_available()).then(|| if p.dark { hex(0x2C2C2C) } else { hex(0xF9F9F9) })
}
diff --git a/crates/rf-win/src/window.rs b/crates/rf-win/src/window.rs
index af3fcb55..9c9e17cf 100644
--- a/crates/rf-win/src/window.rs
+++ b/crates/rf-win/src/window.rs
@@ -147,6 +147,14 @@ pub fn set_rounded_no_border(hwnd: isize) {
}
}
+/// The colour of the thin border Windows 11 draws around this window, as a COLORREF (0x00BBGGRR).
+pub fn set_border_color(hwnd: isize, colorref: u32) {
+ use windows::Win32::Graphics::Dwm::{DWMWA_BORDER_COLOR, DwmSetWindowAttribute};
+ unsafe {
+ let _ = DwmSetWindowAttribute(HWND(hwnd as *mut _), DWMWA_BORDER_COLOR, &colorref as *const _ as _, std::mem::size_of::<u32>() as u32);
+ }
+}
+
pub fn set_dark_mode(hwnd: isize, dark: bool) {
use windows::Win32::Graphics::Dwm::{DWMWA_USE_IMMERSIVE_DARK_MODE, DwmSetWindowAttribute};
let v: i32 = dark as i32;