Skip to main content
net7.0net8.0

ColorPicker dialog for Avalonia

Published
Jan 27, 2024
2y ago
Total Downloads
7.7K
7,701

Install

dotnet add package Egorozh.ColorPicker.Avalonia.Dialog --version 11.0.1
ProductVersions
.NET
net7.0net8.0

README

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>

Changes from Previous Version

v11.0.0v11.0.1
Added Frameworks
net8.0
Added Dependencies
Removed Dependencies

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

No SPDX license expression is published. Review the license text and your organisation's policy before redistribution.Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.