https://github.com/fernandezja/colorhashsharp
Generate color based on the given string. C# port of ColorHash Javascript Library.
https://github.com/fernandezja/colorhashsharp
color color-hash hash hashing string-hash
Last synced: 7 months ago
JSON representation
Generate color based on the given string. C# port of ColorHash Javascript Library.
- Host: GitHub
- URL: https://github.com/fernandezja/colorhashsharp
- Owner: fernandezja
- License: mit
- Created: 2018-12-24T12:37:40.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2025-07-13T13:11:03.000Z (7 months ago)
- Last Synced: 2025-07-13T15:23:40.805Z (7 months ago)
- Topics: color, color-hash, hash, hashing, string-hash
- Language: C#
- Homepage:
- Size: 147 KB
- Stars: 16
- Watchers: 3
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ColorHashSharp
Generate color based on the given string. C# port of [ColorHash Javascript Library](https://github.com/zenozeng/color-hash).
[](https://www.nuget.org/packages/ColorHashSharp/) [](https://www.nuget.org/packages/ColorHashSharp/) [](https://www.codefactor.io/repository/github/fernandezja/colorhashsharp)
[](https://github.com/fernandezja/ColorHashSharp/actions/workflows/dotnet-core.yml) [](https://fernandezja.visualstudio.com/ColorHashSharp/_build/latest?definitionId=4)
#### Status
|Actions |master |develop |
|--- |--- |--- |
|CI |[](https://github.com/fernandezja/ColorHashSharp/actions/workflows/dotnet-core.yml) |[](https://github.com/fernandezja/ColorHashSharp/actions/workflows/dotnet-core.yml) |
#### Basic
```csharp
Debug.WriteLine($"ColorHash > Hello World");
var colorHash = new ColorHash();
//HSL (return HSL object)
var hsl = colorHash.Hsl("Hello World");
Debug.WriteLine($" H = {hsl.H} | S = {hsl.S} | L = {hsl.L}");
// H = 225 | S = 0,35 | L = 0,65
//RGB (return System.Drawing.Color object)
var color = colorHash.Rgb("Hello World");
Debug.WriteLine($" R= {color.R} | G = {color.G} | B = {color.B}");
// R= 135 | G = 150 | B = 197
//Hex (return string)
var hex = colorHash.Hex("Hello World");
Debug.WriteLine($" hex = {hex}");
// hex = 8796C5
```