Skip to content

Name That Color - JavaScript (Credit to Chirag Mehta)-Chinese(中文本地化 by hhy12lpg)

License

Notifications You must be signed in to change notification settings

hhy12lpg/ntc-js-chn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ntc-js-chn

name-that-color-javascript-chinese

Name That Color! 将你的十六进制颜色,匹配成听起来很有格调的名字!关键是速度快,无死角!

支持1500+种颜色!

现已支持响应式用法!

您可以直接下载运行我们编译好的Release来看看效果!

ntc.js 的中文本地化版本,对颜色名字进行了翻译,准确度尚可,可用于个人或商业项目(请仔细核对颜色名字)。

The Chinese localized version of ntc.js. Translates the color names with OKAY accuracy and can be used for personal or commercial projects (please verify the color names again carefully).

核心组件:./ntc-chn.js

重申用法:

import ntc from '../../ntc-chn.js' //必要时改成自己的存放位置

var n_match  = ntc.name("#6195ED"); //输入十六进制颜色,返回一个n_match[0][1][2]三元数组,值分别为:
n_rgb        = n_match[0]; // 根据输入的十六进制颜色匹配到的有名字的最接近的颜色的RGB值(基本没用)
n_name       = n_match[1]; // 根据输入的十六进制颜色匹配到的有名字的最接近的颜色的名字(测试用例用到)
n_exactmatch = n_match[2]; // 精确匹配时为True,近似匹配时为False

alert(n_match); //测试代码

在测试用例中只测试了n_name = n_match[1] 这个模块(只匹配颜色名字而不使用匹配RGB或者“是否精确匹配”功能)

包含一个 vue3 和 naive-ui 构建的测试用例(./RGBp)。需要使用时在 ./RGBp 下执行 npm install 之后使用 npm run dev来运行示例网页(构建测试用例时请务必Download完整的项目目录结构!!)

当然,赶时间的话您可以直接下载运行我们编译好的Release来看看效果!

LICENSE: CC0 1.0 UNIVERSAL

==============================================================

Name That Colour - JavaScript (Credit to Chirag Mehta)

Originally created by Chirag Mehta (http://chir.ag/projects/name-that-color/) is a very useful and free to use JavaScript file that allows you to feed in HTML colour codes (e.g. #FFFFFF) which will output the colour's name or at least its closest match.

It was licenced under Creative Commons licence, therefore I feel I'm within my right to modify and freely redistribute it further.

I placed comments in the index.html and ntc.js to demonstrate how these can be used.

More examples coming soon.

About

Name That Color - JavaScript (Credit to Chirag Mehta)-Chinese(中文本地化 by hhy12lpg)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 82.3%
  • Vue 17.2%
  • HTML 0.5%