diff --git a/ColorPicker/Properties/Resources.Designer.cs b/ColorPicker/Properties/Resources.Designer.cs
index 5ff935a..425ff33 100644
--- a/ColorPicker/Properties/Resources.Designer.cs
+++ b/ColorPicker/Properties/Resources.Designer.cs
@@ -1455,6 +1455,42 @@ public class Resources {
}
}
+ ///
+ /// Looks up a localized string similar to Score.
+ ///
+ public static string Score {
+ get {
+ return ResourceManager.GetString("Score", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to 4.5+ (AA).
+ ///
+ public static string ScoreAA {
+ get {
+ return ResourceManager.GetString("ScoreAA", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to 7+ (AAA).
+ ///
+ public static string ScoreAAA {
+ get {
+ return ResourceManager.GetString("ScoreAAA", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to All.
+ ///
+ public static string ScoreAll {
+ get {
+ return ResourceManager.GetString("ScoreAll", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Second color.
///
diff --git a/ColorPicker/Properties/Resources.en-US.resx b/ColorPicker/Properties/Resources.en-US.resx
index 805174c..a74f639 100644
--- a/ColorPicker/Properties/Resources.en-US.resx
+++ b/ColorPicker/Properties/Resources.en-US.resx
@@ -717,4 +717,16 @@
Contrast Grid
+
+ Score
+
+
+ 4.5+ (AA)
+
+
+ 7+ (AAA)
+
+
+ All
+
\ No newline at end of file
diff --git a/ColorPicker/Properties/Resources.fr-FR.resx b/ColorPicker/Properties/Resources.fr-FR.resx
index 0d40763..4263512 100644
--- a/ColorPicker/Properties/Resources.fr-FR.resx
+++ b/ColorPicker/Properties/Resources.fr-FR.resx
@@ -721,4 +721,16 @@
Grille de Contraste
+
+ Score
+
+
+ 4.5+ (AA)
+
+
+ 7+ (AAA)
+
+
+ Tout
+
\ No newline at end of file
diff --git a/ColorPicker/Properties/Resources.resx b/ColorPicker/Properties/Resources.resx
index 5bc24f1..7634698 100644
--- a/ColorPicker/Properties/Resources.resx
+++ b/ColorPicker/Properties/Resources.resx
@@ -697,4 +697,16 @@
Contrast Grid
+
+ Score
+
+
+ 4.5+ (AA)
+
+
+ 7+ (AAA)
+
+
+ All
+
\ No newline at end of file
diff --git a/ColorPicker/Properties/Resources.zh-CN.resx b/ColorPicker/Properties/Resources.zh-CN.resx
index 48ac6bf..3c17395 100644
--- a/ColorPicker/Properties/Resources.zh-CN.resx
+++ b/ColorPicker/Properties/Resources.zh-CN.resx
@@ -725,4 +725,16 @@
对比网格
+
+ 得分
+
+
+ 4.5+ (AA)
+
+
+ 7+ (AAA)
+
+
+ 全部
+
\ No newline at end of file
diff --git a/ColorPicker/UserControls/ColorGridItem.xaml.cs b/ColorPicker/UserControls/ColorGridItem.xaml.cs
index 5bcf5a6..901d7e6 100644
--- a/ColorPicker/UserControls/ColorGridItem.xaml.cs
+++ b/ColorPicker/UserControls/ColorGridItem.xaml.cs
@@ -46,24 +46,32 @@ namespace ColorPicker.UserControls
///
public partial class ColorGridItem : UserControl
{
+
public RGB ForegroundColor { get; }
public RGB BackgroundColor { get; }
- public ColorGridItem(HSL foregroundColor, HSL backgroundColor)
+ public ColorGridItem(HSL foregroundColor, HSL backgroundColor, double limit)
{
InitializeComponent();
ForegroundColor = ColorHelper.ColorConverter.HslToRgb(foregroundColor);
BackgroundColor = ColorHelper.ColorConverter.HslToRgb(backgroundColor);
- InitUI();
+ InitUI(limit);
}
- private void InitUI()
+ private void InitUI(double limit)
{
+ double contrast = Global.GetContrastDouble([ForegroundColor.R, ForegroundColor.G, ForegroundColor.B], [BackgroundColor.R, BackgroundColor.G, BackgroundColor.B]);
+ if (contrast < limit)
+ {
+ ColorBorder.Background = Global.GetColorFromResource("Background2");
+ return;
+ }
+
ColorBorder.Background = new SolidColorBrush { Color = Color.FromRgb(BackgroundColor.R, BackgroundColor.G, BackgroundColor.B) };
RatioTxt.Foreground = new SolidColorBrush { Color = Color.FromRgb(ForegroundColor.R, ForegroundColor.G, ForegroundColor.B) };
- RatioTxt.Text = Global.GetContrast([ForegroundColor.R, ForegroundColor.G, ForegroundColor.B], [BackgroundColor.R, BackgroundColor.G, BackgroundColor.B]).Item1;
+ RatioTxt.Text = contrast.ToString();
}
}
}