public ColorPickerViewModel() { ForegroundColor = new ObservableColor(Colors.Transparent); BackgroundColor = new ObservableColor(Colors.Transparent); CurrentEditorColor = ForegroundColor; ForegroundColor.PropertyChanged += ForegroundColor_PropertyChanged; BackgroundColor.PropertyChanged += BackgroundColor_PropertyChanged; _calculateSuggestedColors = new TimeLimitedAction(() => { var color1 = IsForegroundBeingEdited ? ForegroundColor.Color : BackgroundColor.Color; var color2 = IsForegroundBeingEdited ? BackgroundColor.Color : ForegroundColor.Color; var suggestedColors = UseExtraContrastSuggestions ? ContrastHelpers.FindSimilarAAAColor(color1, color2) : ContrastHelpers.FindSimilarAAColor(color1, color2); SuggestedColors.Clear(); foreach (var suggestion in suggestedColors) { SuggestedColors.Add(suggestion.Color); } ShowSuggestedColors = SuggestedColors.Any(); }, TimeSpan.FromSeconds(1)); CalculateContrast(); }
public ColorPickerViewModel() { ForegroundColor = new ObservableColor(Colors.Transparent); BackgroundColor = new ObservableColor(Colors.Transparent); CurrentEditorColor = ForegroundColor; }