Skip to content

Commit 8173cb8

Browse files
committed
Added info about external DLLs
1 parent a900ea2 commit 8173cb8

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

README.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# WPFColorLib
2-
3-
This library is created for "WPF/.NET FW 4.8" and intended to work with colors.
4-
5-
-------------------------------------------------------------------------------------
6-
Standard WPF lacks of color selection dialog and WPFColorLib fills this niche with brand new approach:
7-
8-
![Picture of dialog]( https://i.imgur.com/yeyOuX5_d.webp?maxwidth=760&fidelity=grand )
9-
10-
Description of functionality:
11-
1+
# WPFColorLib
2+
3+
This library is created for "WPF/.NET FW 4.8" and intended to work with colors.
4+
5+
-------------------------------------------------------------------------------------
6+
Standard WPF lacks of color selection dialog and WPFColorLib fills this niche with brand new approach:
7+
8+
![Picture of dialog]( https://i.imgur.com/yeyOuX5_d.webp?maxwidth=760&fidelity=grand )
9+
10+
Description of functionality:
11+
1212
- First, user selects desirable Hue level using top slider
1313
- Saturation/Luminosity gradient below shows color variations of current hue
1414
- Clicking/moving mouse on gradient selects one specific color (and button `OK` become enabled)
@@ -17,9 +17,9 @@ Description of functionality:
1717
- Right from "New color" block there is "Old color" if dialog was called with some original color (to compare)
1818
- Each value, hex or dec, can be typed directly (and confirmed with `Enter`) or pasted from
1919
Clipboard (using button on the left of the field)
20-
> Note that pasted text can be any free text taken from CSS, for example. Strings like
21-
`#p1 {background-color: #ff0000;} /* red */` will be correctly parsed, catchig first matching
22-
RGB hex value (here `ff0000`)
20+
> Note that pasted text can be any free text taken from CSS, for example. Strings like
21+
`#p1 {background-color: #ff0000;} /* red */` will be correctly parsed, catchig first matching
22+
RGB hex value (here `ff0000`)
2323
- Right from Dec/Hex fields there is ❍ (copy to Clipboard) button. Old color also can be copied
2424
- Once color is selected, "Luminosity palette" is filled with 11 variations of current color,
2525
where H/S is the same and "Luminosity" level vary from 0 to 100 with step 10 - these
@@ -28,28 +28,31 @@ Description of functionality:
2828
- When you click with *left* mouse button on "Favorite color" sample, its color become selected.
2929
*Right* click deletes this sample
3030
- "Favorite colors" also can be *generated*: right click on favorite area and select 16-color
31-
Apple's palette or click "Standard 6 level" to generate 216-colors palette, where each
32-
color has 6-level variations of RGB components /easier to try than explain :) /.
33-
From the same popup you can clear favorites
31+
Apple's palette or click "Standard 6 level" to generate 216-colors palette, where each
32+
color has 6-level variations of RGB components /easier to try than explain :) /.
33+
From the same popup you can clear favorites
3434
- "Favorite colors" are saved between dialog calls, but lost when you exit application
3535

3636
Usage:
3737

38+
Reference necessary DLLs: [System.Memory](https://www.nuget.org/packages/System.Memory)
39+
and [System.Runtime.CompilerServices.Unsafe](https://www.nuget.org/packages/System.Runtime.CompilerServices.Unsafe/)
40+
3841
```C#
3942
var dlg = new SelectColorDlg(Colors.Bisque) { Owner = this };
4043
if (dlg.ShowDialog() == true) {
4144
var color = dlg.SelectedColor;// as Color struct
4245
var brush = dlg.SelectedBrush;// the same, but as SolidColorBrush
4346
}
4447
```
45-
46-
-------------------------------------------------------------------------------------
47-
48-
WPFColorLib also contains a few helpers in a static class `ClrHlp`:
49-
48+
49+
-------------------------------------------------------------------------------------
50+
51+
WPFColorLib also contains a few helpers in a static class `ClrHlp`:
52+
5053
- ColorToHSL - convert `Color` struct to (H, S, L) presentation (H=0..359, S=0..100, L=0..100)
5154
- Hex2color - takes free text with hex RGB presentation and returns created `Color`
5255
- Color2hex - takes `Color` and returns hex RGB presentation
5356
- Hex2Byte - parse hex byte presentation to native `byte` type
5457
- HSL2RGB - convert (H,S,L) color to its RGB presentation (as array of 3 `int`s)
55-
- HSL2RGBInt - the same as `HSL2RGB`, but returns RGB components packed into integer
58+
- HSL2RGBInt - the same as `HSL2RGB`, but returns RGB components packed into integer

0 commit comments

Comments
 (0)