1. Download NTC.js
You can download the ntc.js script file from the official website here. With the NTC tool you will be able to guess the closest color according to its given code and the register in the class. It's worth to say that the art of guessing a color by its hexadecimal code its pretty tricky, as well of the appreciation of naming a color could vary as well. However, the original JS script offers a wide range of colors that may match your hex code, if it isn't registered in the class, it will return the closest color.
For more information about this project, please visit the official website here.
2. How to use
Initially, you only will need to cast the name method of the ntc object created by the library, whose initialization takes a little execution time because it will create a quite huge color palette that it will use to compare your hex code with the available data. From the instance, you will be able to use 3 methods. Of our interest is only the
name method useful:
This method expects as first argument a string with a hexadecimal color code of 6 or 3 digits e.g #ffffff or #fff and returns an array with the data that you need to know according to the color guess process. The array contains 3 items respectively:
0: the hex color of the closest color in the class.
1: the human name given to the color.
2: boolean that determines wheter the color code is exact as the name or not.
The property that you are looking for is the name key that returns an human name for the hex color code, in this case is the Deep Sea color, but it works for almost every hex color that you provide, in case that it doesn't work with your color, you will receive an array with the same 3 items, however with the following values:
1: Invalid Color: $yourHexCodeString.
Happy coding !