Skip to content

Commit

Permalink
formatted files
Browse files Browse the repository at this point in the history
  • Loading branch information
JanTamis committed Jun 5, 2023
1 parent f5e5582 commit 779d915
Show file tree
Hide file tree
Showing 312 changed files with 14,204 additions and 14,897 deletions.
17 changes: 9 additions & 8 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,29 @@ dotnet_style_predefined_type_for_member_access = true:suggestion

# name all constant fields using PascalCase
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style

dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.required_modifiers = const

dotnet_naming_style.pascal_case_style.capitalization = pascal_case

# static fields should have s_ prefix
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style

dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.required_modifiers = static

dotnet_naming_style.static_prefix_style.required_prefix = s_
dotnet_naming_style.static_prefix_style.capitalization = camel_case

# internal and private fields should be _camelCase
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style

dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
Expand Down Expand Up @@ -164,5 +164,6 @@ indent_size = 2
# Shell scripts
[*.sh]
end_of_line = lf

[*.{cmd, bat}]
end_of_line = crlf
4 changes: 2 additions & 2 deletions Material.Avalonia/Material.Avalonia.Templates.xaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Styles xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Material.Avalonia.MaterialAvaloniaTemplates">
<StyleInclude Source="avares://Material.Styles/MaterialToolKit.xaml" />
</Styles>
<StyleInclude Source="avares://Material.Styles/MaterialToolKit.xaml" />
</Styles>
8 changes: 3 additions & 5 deletions Material.Avalonia/Material.Avalonia.Templates.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
namespace Material.Avalonia
{
public class MaterialAvaloniaTemplates : global::Avalonia.Styling.Styles
{
namespace Material.Avalonia {
public class MaterialAvaloniaTemplates : global::Avalonia.Styling.Styles {
}
}
}
92 changes: 46 additions & 46 deletions Material.Avalonia/Material.Avalonia.csproj
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>8</LangVersion>
<Nullable>enable</Nullable>
<NoWarn>NU5104, NU1507</NoWarn>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>8</LangVersion>
<Nullable>enable</Nullable>
<NoWarn>NU5104, NU1507</NoWarn>

<Title>Material.Avalonia</Title>
<Authors>Larymar,SKProCH,Appleneko2001</Authors>
<Description>This repository is a set of styles that will help you customize your application in an appropriate material design.</Description>
<PackageProjectUrl>https://github.com/AvaloniaCommunity/Material.Avalonia</PackageProjectUrl>
<RepositoryUrl>https://github.com/AvaloniaCommunity/Material.Avalonia</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>avalonia xaml material design theme colour color ui ux material-design google-material</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>FavIcon.png</PackageIcon>
<VersionPrefix>3.0.0-avalonia11-preview4</VersionPrefix>
<PackageReleaseNotes>
This is UNSTABLE version, I think what many things do not work properly here, report all bugs to issues at GitHub.
- Avalonia 11 Preview 6 support
- Removes workaround for theme changing
- Fixes and reformat sliders #217
- Migrate from DirectProperties to StylesProperties in Scroller. Fixes TabControl styles #217
- Exclude DatePicker from styles collection
- Add Flyout styles, migrate TextBox tooltip to flyout
- Make MaterialDesignLightTheme and MaterialDesignDarkTheme internal sealed, rename ThemeChanged to ThemeChangedEnd
- Add ActualBaseTheme property to MaterialTheme, allowing to adapt to Application
- Removes the shadow hint for ContextMenu. Fixes #219
- Add AreVerticalSnapPointsRegular and AreHorizontalSnapPointsRegular for ListBox and ItemsControl templates
</PackageReleaseNotes>
</PropertyGroup>
<Title>Material.Avalonia</Title>
<Authors>Larymar,SKProCH,Appleneko2001</Authors>
<Description>This repository is a set of styles that will help you customize your application in an appropriate material design.</Description>
<PackageProjectUrl>https://github.com/AvaloniaCommunity/Material.Avalonia</PackageProjectUrl>
<RepositoryUrl>https://github.com/AvaloniaCommunity/Material.Avalonia</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>avalonia xaml material design theme colour color ui ux material-design google-material</PackageTags>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>FavIcon.png</PackageIcon>
<VersionPrefix>3.0.0-avalonia11-preview4</VersionPrefix>
<PackageReleaseNotes>
This is UNSTABLE version, I think what many things do not work properly here, report all bugs to issues at GitHub.
- Avalonia 11 Preview 6 support
- Removes workaround for theme changing
- Fixes and reformat sliders #217
- Migrate from DirectProperties to StylesProperties in Scroller. Fixes TabControl styles #217
- Exclude DatePicker from styles collection
- Add Flyout styles, migrate TextBox tooltip to flyout
- Make MaterialDesignLightTheme and MaterialDesignDarkTheme internal sealed, rename ThemeChanged to ThemeChangedEnd
- Add ActualBaseTheme property to MaterialTheme, allowing to adapt to Application
- Removes the shadow hint for ContextMenu. Fixes #219
- Add AreVerticalSnapPointsRegular and AreHorizontalSnapPointsRegular for ListBox and ItemsControl templates
</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
<None Include="../README.md" Pack="true" PackagePath="/"/>
<None Include="../wiki/FavIcon.png" Pack="true" PackagePath="/"/>
</ItemGroup>
<ItemGroup>
<None Include="../README.md" Pack="true" PackagePath="/"/>
<None Include="../wiki/FavIcon.png" Pack="true" PackagePath="/"/>
</ItemGroup>

<!--For nightly versions-->
<PropertyGroup>
<Version Condition="'$(PatchNumber)' != ''">$(VersionPrefix).$(PatchNumber)</Version>
</PropertyGroup>
<!--For nightly versions-->
<PropertyGroup>
<Version Condition="'$(PatchNumber)' != ''">$(VersionPrefix).$(PatchNumber)</Version>
</PropertyGroup>

<ItemGroup>
<AvaloniaResource Include="**\*.xaml">
<SubType>Designer</SubType>
</AvaloniaResource>
</ItemGroup>
<ItemGroup>
<AvaloniaResource Include="**\*.xaml">
<SubType>Designer</SubType>
</AvaloniaResource>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Material.Styles\Material.Styles.csproj"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Material.Styles\Material.Styles.csproj"/>
</ItemGroup>
</Project>
49 changes: 19 additions & 30 deletions Material.Colors/ColorManipulation/ColorHelper.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
using System;
using Avalonia.Media;

namespace Material.Colors.ColorManipulation
{
public static class ColorHelper
{
namespace Material.Colors.ColorManipulation {
public static class ColorHelper {
[Obsolete("Please use PickContrastColor method instead.")]
public static Color ContrastingForegroundColor(this Color color) =>
PickContrastColor(color);
public static Color ContrastingForegroundColor(this Color color) {
return PickContrastColor(color);
}

/// <summary>
/// Choose most accessible color by algorithm. The primary and secondary color is pure black and white.
/// </summary>
/// <param name="color">Background color</param>
/// <param name="ratio">Minimal contrast ratio. It is 4.5 by default.</param>
/// <returns>The most accessible color (AAA or AA level) for text</returns>
public static Color PickContrastColor(this Color color, double ratio = 4.5)
{
public static Color PickContrastColor(this Color color, double ratio = 4.5) {
return AlgorithmContrastColor(color, Avalonia.Media.Colors.Black, Avalonia.Media.Colors.White, ratio);
}

Expand All @@ -28,25 +26,21 @@ public static Color PickContrastColor(this Color color, double ratio = 4.5)
/// <param name="b">Secondary accessible color</param>
/// <param name="ratio">Minimal contrast ratio. It is 4.5 by default.</param>
/// <returns>The most accessible color for text or control (not guarantee its accessible because the primary and secondary colors might not most used on UIs.)</returns>
public static Color PickContrastColor(this Color color, Color a, Color b, double ratio = 4.5)
{
public static Color PickContrastColor(this Color color, Color a, Color b, double ratio = 4.5) {
return AlgorithmContrastColor(color, a, b, ratio);
}

public static Color ShiftLightness(this Color color, int amount = 1)
{
public static Color ShiftLightness(this Color color, int amount = 1) {
var lab = color.ToLab();
var shifted = new Lab(lab.L - LabConstants.Kn * amount, lab.A, lab.B);
return shifted.ToColor();
}

public static Color Darken(this Color color, int amount = 1)
{
public static Color Darken(this Color color, int amount = 1) {
return color.ShiftLightness(amount);
}

public static Color Lighten(this Color color, int amount = 1)
{
public static Color Lighten(this Color color, int amount = 1) {
return color.ShiftLightness(-amount);
}

Expand All @@ -56,14 +50,13 @@ public static Color Lighten(this Color color, int amount = 1)
/// </summary>
/// <param name="c">Color used for measurement.</param>
/// <returns>The magnitude of relative luminance of color</returns>
public static double RelativeLuminance(this Color c)
{
public static double RelativeLuminance(this Color c) {
double Process(double s) =>
s < 0.03928 ? s / 12.92 : Math.Pow((s + 0.055) / 1.055, 2.4);

double dR = (double) c.R / 255,
dG = (double) c.G / 255,
dB = (double) c.B / 255;
double dR = (double)c.R / 255,
dG = (double)c.G / 255,
dB = (double)c.B / 255;

var r = Process(dR);
var g = Process(dG);
Expand All @@ -78,8 +71,7 @@ double Process(double s) =>
/// <param name="a">First color</param>
/// <param name="b">Second color</param>
/// <returns>Maximum possible contrast value. E.g: contrast white and black is 21, then it return 21.</returns>
public static double Contrast(this Color a, Color b)
{
public static double Contrast(this Color a, Color b) {
var l1 = RelativeLuminance(a) + 0.05;
var l2 = RelativeLuminance(b) + 0.05;

Expand All @@ -97,8 +89,7 @@ public static double Contrast(this Color a, Color b)
/// <param name="color"></param>
/// <param name="other"></param>
/// <returns></returns>
public static double Difference(this Color color, Color other)
{
public static double Difference(this Color color, Color other) {
var lab1 = color.ToLab();
var lab2 = other.ToLab();

Expand All @@ -108,15 +99,13 @@ public static double Difference(this Color color, Color other)
}

// https://github.com/LeaVerou/contrast-ratio
private static Color AlgorithmContrastColor(Color backColor, Color a, Color b, double ratio = 4.5)
{
private static Color AlgorithmContrastColor(Color backColor, Color a, Color b, double ratio = 4.5) {
var contrast1 = Contrast(backColor, a);
var contrast2 = Contrast(backColor, b);

Color result;

switch (contrast1 >= ratio)
{
switch (contrast1 >= ratio) {
case true:
result = contrast1 > contrast2 ? a : b;
break;
Expand All @@ -128,4 +117,4 @@ private static Color AlgorithmContrastColor(Color backColor, Color a, Color b, d
return result;
}
}
}
}
11 changes: 4 additions & 7 deletions Material.Colors/ColorManipulation/Hsb.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
namespace Material.Colors.ColorManipulation
{
public struct Hsb
{
namespace Material.Colors.ColorManipulation {
public struct Hsb {
public double Hue { get; }
public double Saturation { get; }
public double Brightness { get; }

public Hsb(double hue, double saturation, double brightness)
{
public Hsb(double hue, double saturation, double brightness) {
Hue = hue;
Saturation = saturation;
Brightness = brightness;
}
}
}
}
Loading

0 comments on commit 779d915

Please sign in to comment.