From 1c1845fc762511471087b3f9300d73c3a33a966c Mon Sep 17 00:00:00 2001 From: Mika Vilpas Date: Tue, 14 May 2024 22:23:33 +0300 Subject: [PATCH] feat: allow themes to add a custom style for file extensions --- .luarc.json | 7 + yazi-config/src/theme/theme.rs | 7 +- yazi-fm/src/lives/file.rs | 36 ++- .../file/highlightable_filename_builder.rs | 261 ++++++++++++++++++ yazi-plugin/preset/components/file.lua | 22 +- yazi-plugin/src/elements/span.rs | 4 +- yazi-plugin/src/elements/style.rs | 4 +- yazi-plugin/src/url/url.rs | 3 + yazi-shared/src/theme/color.rs | 8 +- yazi-shared/src/theme/style.rs | 12 +- 10 files changed, 325 insertions(+), 39 deletions(-) create mode 100644 .luarc.json create mode 100644 yazi-fm/src/lives/file/highlightable_filename_builder.rs diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 00000000..771b5265 --- /dev/null +++ b/.luarc.json @@ -0,0 +1,7 @@ +{ + "diagnostics.globals": [ + "ui", + "THEME", + "MANAGER" + ] +} \ No newline at end of file diff --git a/yazi-config/src/theme/theme.rs b/yazi-config/src/theme/theme.rs index 00508ded..9d170e4a 100644 --- a/yazi-config/src/theme/theme.rs +++ b/yazi-config/src/theme/theme.rs @@ -49,13 +49,16 @@ impl Default for Theme { pub struct Manager { cwd: Style, + /// The style for files that have an extension + pub extension: Option