Git Product home page Git Product logo

colormineportable's Introduction

ColorMinePortable

This is the library that it made ColorMine(https://github.com/THEjoezack/ColorMine) correspond to portable class library.

This program uses the following munsell data.

http://www.rit.edu/cos/colorscience/rc_munsell_renotation.php real.dat

Nuget Installation

Install-Package ColorMinePortable

Difference form original

  • Add ColorSpace
    • Munsell(approximate)
    • Hex
  • not supported CMYK profiles
  • changed HSL value range 0 to 1
  • changed HSV and HSB algorithm

Munsell Conversion

var munsell = new Munsell("5R 4/10");	//Chromatic color
var rgb = munsell.To<Rgb>();
var str = munsell.ToString(); // return "5R 4/10"
var retmunsell = rgb.To<Munsell>();	// approximate.  Not Equal "5R 4/10".

var munsell2 = new Munsell("N7.5"); //Achromatic color
var rgb2 = munsell2.To<Rgb>();

Hex Conversion

var hex  = new Hex("#FFFFFF");
var hex2 = new Hex("FFFFFF");	//  # none OK
var hex3 = new Hex("FFF");		// Triplet OK

var rgb = hex.To<Rgb>();
var code = hex.Code;	// return "#FFFFFF"
var rethex = rgb.To<Hex>();	// "#FFFFFF"

ColorMine

MIT Licensed .Net library that makes converting between color spaces and comparing colors easy.

Getting Started

ColorMine is available as a nuget package so you can install by searching for "ColorMine" in the "Manage Nuget Packages" menu, or run the following command in the Package Manager Console:

PM> Install-Package ColorMine

Color Conversions

You can convert between any supported color spaces via generic methods like so:

var myRgb = new Rgb { R = 149, G = 13, B = 12 }
var myCmy = myRgb.To<Cmy>();
var myXyz = new Xyz { X = .44, Y = .7, Z = .99 }
var myLab = myXyz.To<Lab>();
var myYxy = new Xyz { Y1 = .1124, X = .22, Y2 = .14 }
var myHsl = myYxy.To<Hsl>();

Cmyk conversion also supports profiles

var myCmyk = myRgb
    .WithProfile("~/JapanWebCoated.icc")
    .To<Cmyk>();
var myHunterLab = myCmyk
    .WithProfile("~/JapanWebCoated.icc")
    .To<HunterLab>();

Online example at http://colormine.org/color-converter

Delta-E

Delta-E calculations take and compare colors in any of the supported formats.

double deltaE = myRgb.Compare(myCmy,new Cie1976Comparison());
double deltaE = myXyz.Compare(myLab,new CmcComparison(lightness: 2, chroma: 1));
double deltaE = myYxy.Compare(myHsl,new Cie94(Cie94Comparison.Application.GraphicArts));
double deltaE = myHunterLab.Compare(myLuv, new CieDe2000());

Huge thanks to Jonathan Hofinger for correct implementation of CieDe2000 and to Gaurav Sharma for test data.

Note: Delta-e calculations are quasimetric, the result of comparing color a to b isn't always equal to comparing color b to a...but it will probably be pretty close!


Currently Supported Color Spaces

  • CMY
  • CMYK
  • HSL
  • HSB
  • HSV
  • CIE L*AB
  • Hunter LAB
  • LCH
  • LUV
  • RGB
  • XYZ
  • YXY

Currently Supported Comparisons

  • CIE76
  • CMC l:c
  • CIE94
  • CIE2000

colormineportable's People

Contributors

muak avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.