Skip to content

🎨🎨🎨 Best of the best ColorPicker on WPF and AvaloniaUI

License

Notifications You must be signed in to change notification settings

egorozh/Egorozh.ColorPicker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nuget (with prereleases) Nuget (with prereleases) Nuget (with prereleases)

Egorozh.ColorPicker

AvaloniaUI ColorPicker:

example example example

AvaloniaUI Getting Started

Install the library as a NuGet package:

Install-Package Egorozh.ColorPicker.Avalonia.Dialog
# Or 'dotnet add package Egorozh.ColorPicker.Avalonia.Dialog'

Then, reference the preffered theme from your App.xaml file:

<Application xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:dialog="clr-namespace:Egorozh.ColorPicker.Dialog;assembly=Egorozh.ColorPicker.Avalonia.Dialog"
             x:Class="YourNamespace.App">
  <Application.Styles>
      
      <SimpleTheme Mode="Dark"/>
      <dialog:SimpleColorTheme Mode="Dark"/>

      <!-- To use other themes:-->
      <!-- <FluentTheme Mode="Light" /> -->
      <!-- <dialog:FluentColorPickerTheme Mode="Light" /> -->

      <!-- <FluentTheme Mode="Dark" />  -->
      <!-- <dialog:FluentColorPickerTheme Mode="Dark" /> -->
  </Application.Styles>
</Application>

Done! Use ColorPickerButton

<dialog:ColorPickerButton Color="#99029344"
                          Cursor="Hand"/>

or ColorPickerDialog:

ColorPickerDialog dialog = new ()
{
  Color = _color
};

var res = await dialog.ShowDialog<bool>(Owner);

if (res)
  _color = dialog.Color;

WPF ColorPicker:

example example example example example

WPF Getting Started

Install the library as a NuGet package:

Install-Package Egorozh.ColorPicker.WPF.Dialog
# Or 'dotnet add package Egorozh.ColorPicker.WPF.Dialog'

Done! Use ColorPickerButton

<dialog:ColorPickerButton Color="#99029344"
                          Cursor="Hand"/>

or ColorPickerDialog:

var dialog = new ColorPickerDialog
{
  Owner = Owner,
  Color = Color
};

var res = dialog.ShowDialog();

if (res == true)
  Color = dialog.Color;

To run MahApps Version:

Install the library as a NuGet package:

Install-Package Egorozh.ColorPicker.WPF.Dialog.MahApps
# Or 'dotnet add Egorozh.ColorPicker.WPF.Dialog.MahApps'

Then, reference the preffered theme from your App.xaml file:

<Application x:Class="Egorozh.ColorPicker.Client.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            
             StartupUri="MainWindow.xaml">

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Dark.Crimson.xaml" />


                <ResourceDictionary Source="pack://application:,,,/Egorozh.ColorPicker.WPF.Dialog.MahApps;component/Themes/Generic.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>