Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Merge origin/main (own installer, What's new in Setup) into feat/arabic-visual-accent-picker

KnifeLemonfa50d4acd14d
diff --cc src/Filee.App/App.axaml
index 566ccf03,dc1640fd..0491d1ac
--- a/src/Filee.App/App.axaml
+++ b/src/Filee.App/App.axaml
@@@ -21,12 -21,8 +21,13 @@@
<Application.Styles>
<FluentTheme />
+ <StyleInclude Source="avares://Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml" />
+ <!-- ColorSpectrum handles arrow keys but does not enable keyboard focus by default. -->
+ <Style Selector="ColorSpectrum">
+ <Setter Property="Focusable" Value="True" />
+ </Style>
<StyleInclude Source="avares://Filee/Styles/Soft.axaml" />
+ <StyleInclude Source="avares://Filee/Styles/Controls.axaml" />
<StyleInclude Source="avares://Filee/Styles/TagEditor.axaml" />
</Application.Styles>
</Application>
diff --cc src/Filee.App/Services/AppLanguages.cs
index 00000000,ddc3ac93..1b110a96
mode 000000,100644..100644
--- a/src/Filee.App/Services/AppLanguages.cs
+++ b/src/Filee.App/Services/AppLanguages.cs
@@@ -1,0 -1,20 +1,21 @@@
+ // The languages Filee ships (Assets/i18n/<code>.json). The installer (src/Filee.Setup) links this file, so a language
+ // added here is offered by Setup too.
+
+ namespace Filee.App.Services;
+
+ internal static class AppLanguages
+ {
+ /// <summary>Code → native name (shown in the language pickers of the app and of Setup).</summary>
+ public static readonly IReadOnlyList<(string Code, string NativeName)> All =
+ [
+ ("en", "English"),
+ ("es", "Español"),
+ ("ja", "日本語"),
+ ("ko", "한국어"),
+ ("zh-CN", "简体中文"),
+ ("pl", "Polski"),
+ ("hi", "हिन्दी"),
+ ("ru", "Русский"),
++ ("ar", "العربية"),
+ ];
+ }
diff --cc src/Filee.App/Services/LocalizationService.cs
index a950c80f,a731606a..5b9013a6
--- a/src/Filee.App/Services/LocalizationService.cs
+++ b/src/Filee.App/Services/LocalizationService.cs
@@@ -118,6 -102,6 +102,9 @@@ public sealed class LocalizationServic
return "hi";
if (ui.StartsWith("ru", StringComparison.OrdinalIgnoreCase))
return "ru";
++ // "ar" and every region ("ar-SA", "ar-EG", …), but not other codes starting with "ar".
++ if (ui.Equals("ar", StringComparison.OrdinalIgnoreCase) || ui.StartsWith("ar-", StringComparison.OrdinalIgnoreCase))
++ return "ar";
return "en";
}
diff --cc src/Filee.App/Services/SoftPalette.cs
index 00000000,a496d0f7..5a037222
mode 000000,100644..100644
--- a/src/Filee.App/Services/SoftPalette.cs
+++ b/src/Filee.App/Services/SoftPalette.cs
@@@ -1,0 -1,101 +1,103 @@@
+ // The resources behind Filee's look that are computed rather than written in Styles/Soft.axaml: the accent colour
+ // with its shades, the corner radii and the UI font order. ThemeService applies them with the user's choices; the
+ // installer (src/Filee.Setup links this file) applies the defaults, so Setup looks like the app.
+
+ using Avalonia;
+ using Avalonia.Controls;
+ using Avalonia.Media;
+
+ namespace Filee.App.Services;
+
+ internal static class SoftPalette
+ {
+ /// <summary>The default accent colour (the first swatch of the Theme page).</summary>
+ public const string DefaultAccent = "#7F77DD";
+
+ /// <summary>The default corner radius (ThemeSettings.CornerRadius).</summary>
+ public const double DefaultCornerRadius = 16;
+
+ /// <summary>Embedded Noto fonts (see build/fetch-fonts.ps1). Missing files fall back to system fonts.</summary>
+ private const string Latin = "fonts:Filee#Noto Sans";
++ private const string Arabic = "fonts:Filee#Noto Sans Arabic";
+ private const string Devanagari = "fonts:Filee#Noto Sans Devanagari";
+
+ /// <summary>Each CJK region's embedded font and its system fonts (Windows, then macOS).</summary>
+ private static readonly (string Embedded, string System) Japanese =
+ ("fonts:Filee#Noto Sans JP", "Yu Gothic UI, Meiryo, Hiragino Sans");
+ private static readonly (string Embedded, string System) Korean =
+ ("fonts:Filee#Noto Sans KR", "Malgun Gothic, Apple SD Gothic Neo");
+ private static readonly (string Embedded, string System) Chinese =
+ ("fonts:Filee#Noto Sans SC", "Microsoft YaHei, PingFang SC");
+
+ /// <summary>Accent colour + derived shades. Fluent controls read the System* keys.</summary>
+ public static void ApplyAccent(IResourceDictionary res, Color accent)
+ {
+ res["AccentColor"] = accent;
+ res["AccentBrush"] = new SolidColorBrush(accent);
+ res["AccentSoftBrush"] = new SolidColorBrush(accent, 0.18);
+ res["AccentFaintBrush"] = new SolidColorBrush(accent, 0.09);
+ res["AccentStrongBrush"] = new SolidColorBrush(Shade(accent, -0.25));
+ res["OnAccentBrush"] = new SolidColorBrush(Luminance(accent) > 0.6 ? Color.Parse("#1F1E1D") : Colors.White);
+ res["SystemAccentColor"] = accent;
+ res["SystemAccentColorLight1"] = Shade(accent, 0.15);
+ res["SystemAccentColorLight2"] = Shade(accent, 0.30);
+ res["SystemAccentColorLight3"] = Shade(accent, 0.45);
+ res["SystemAccentColorDark1"] = Shade(accent, -0.15);
+ res["SystemAccentColorDark2"] = Shade(accent, -0.30);
+ res["SystemAccentColorDark3"] = Shade(accent, -0.45);
+ }
+
+ /// <summary>"Softness": one radius drives every control.</summary>
+ public static void ApplyCornerRadius(IResourceDictionary res, double radius)
+ {
+ var r = Math.Clamp(radius, 0, 28);
+ res["SoftRadius"] = new CornerRadius(r);
+ res["SoftRadiusSmall"] = new CornerRadius(Math.Round(r * 0.55));
+ res["SoftRadiusLarge"] = new CornerRadius(Math.Round(r * 1.35));
+ res["ControlCornerRadius"] = new CornerRadius(Math.Round(r * 0.55));
+ res["OverlayCornerRadius"] = new CornerRadius(r);
+ }
+
+ /// <summary>
+ /// The UI font chain. Han characters look different in Japanese, Korean and Chinese fonts, so the UI language's
+ /// CJK fonts come first, embedded and system ones alike; other languages keep Korean first.
+ /// </summary>
+ public static string FontFamilies(string language)
+ {
+ (string Embedded, string System)[] cjk =
+ language.StartsWith("ja", StringComparison.OrdinalIgnoreCase) ? [Japanese, Korean, Chinese]
+ : language.StartsWith("zh", StringComparison.OrdinalIgnoreCase) ? [Chinese, Korean, Japanese]
+ : [Korean, Chinese, Japanese];
- return $"{Latin}, {Devanagari}, {string.Join(", ", cjk.Select(f => f.Embedded))}, Segoe UI, Nirmala UI, "
- + $"{string.Join(", ", cjk.Select(f => f.System))}, Kohinoor Devanagari, sans-serif";
++ // Noto Sans comes first: the first face also draws the trimming ellipsis, which Noto Sans Arabic lacks.
++ return $"{Latin}, {Arabic}, {Devanagari}, {string.Join(", ", cjk.Select(f => f.Embedded))}, Segoe UI, Nirmala UI, "
++ + $"{string.Join(", ", cjk.Select(f => f.System))}, Kohinoor Devanagari, Geeza Pro, sans-serif";
+ }
+
+ /// <summary>
+ /// The font chain from Windows' own UI fonts only (no embedded fonts), with the UI language's CJK font first: what
+ /// the installer uses. Every Windows 10 1809+ has these, with bold faces.
+ /// </summary>
+ public static string SystemFontFamilies(string language)
+ {
+ (string Embedded, string System)[] cjk =
+ language.StartsWith("ja", StringComparison.OrdinalIgnoreCase) ? [Japanese, Korean, Chinese]
+ : language.StartsWith("zh", StringComparison.OrdinalIgnoreCase) ? [Chinese, Korean, Japanese]
+ : [Korean, Chinese, Japanese];
+ return $"Segoe UI, Nirmala UI, {string.Join(", ", cjk.Select(f => f.System))}, sans-serif";
+ }
+
+ /// <summary>The UI font for <paramref name="language"/>.</summary>
+ public static FontFamily FontFamilyFor(string language) => FontFamily.Parse(FontFamilies(language));
+
+ /// <summary>Lightens (amount &gt; 0) or darkens (amount &lt; 0) a colour.</summary>
+ public static Color Shade(Color c, double amount)
+ {
+ byte Mix(byte v) => amount >= 0
+ ? (byte)Math.Round(v + (255 - v) * amount)
+ : (byte)Math.Round(v * (1 + amount));
+ return Color.FromArgb(c.A, Mix(c.R), Mix(c.G), Mix(c.B));
+ }
+
+ /// <summary>Relative luminance 0..1 (sRGB approximation).</summary>
+ public static double Luminance(Color c) => (0.2126 * c.R + 0.7152 * c.G + 0.0722 * c.B) / 255.0;
+ }