Example #1
0
        public void BuildToHsl_HelloWorldString()
        {
            var colorHash = new Fernandezja.ColorHashSharp.ColorHash();

            var result = colorHash.BuildToHsl("Hello World");

            Assert.NotNull(result);
            Assert.Equal(225, result.H);
            Assert.Equal(0.35, result.S);
            Assert.Equal(0.65, result.L);
        }
Example #2
0
        public void BuildToHsl_ShouldCreateAColorWithHSL()
        {
            var colorHash = new Fernandezja.ColorHashSharp.ColorHash();

            var result = colorHash.BuildToHsl("yoda");

            Assert.NotNull(result);
            Assert.Equal(76, result.H);
            Assert.Equal(0.35, result.S);
            Assert.Equal(0.35, result.L);
        }
Example #3
0
        public void BuildToHsl_ShouldCreateAColorInHSL(
            string phrase, double hExpected, double sExpected, double lExpected)
        {
            var colorHash = new Fernandezja.ColorHashSharp.ColorHash();

            var result = colorHash.BuildToHsl(phrase);

            Assert.NotNull(result);
            Assert.Equal(hExpected, result.H);
            Assert.Equal(sExpected, result.S);
            Assert.Equal(lExpected, result.L);
        }
Example #4
0
        public void Build_HelloWorldStringToHslColorAndHex()
        {
            var ColorHash = new Fernandezja.ColorHashSharp.ColorHash();

            var resultHsl   = ColorHash.BuildToHsl("Hello World");
            var resultColor = ColorHash.BuildToColor("Hello World");
            var resultHex   = ColorHash.BuildToHex("Hello World");

            Assert.Equal(135, resultColor.R);
            Assert.Equal(150, resultColor.G);
            Assert.Equal(197, resultColor.B);

            Assert.Equal(225, resultHsl.H);
            Assert.Equal(0.35, resultHsl.S);
            Assert.Equal(0.65, resultHsl.L);

            Assert.Equal("8796C5", resultHex);
        }