First commit.

Signed-off-by: Chen Xiao <abigwc@gmail.com>
This commit is contained in:
Chen Xiao
2026-05-08 14:43:16 +08:00
commit 0b64e2de94
10989 changed files with 2253791 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
/* IMPORT */
import _ from '../utils/index.js';
import luminance from './luminance.js';
/* MAIN */
const contrast = (color1, color2) => {
const luminance1 = luminance(color1);
const luminance2 = luminance(color2);
const max = Math.max(luminance1, luminance2);
const min = Math.min(luminance1, luminance2);
const ratio = (max + Number.EPSILON) / (min + Number.EPSILON);
return _.lang.round(_.lang.clamp(ratio, 1, 10));
};
/* EXPORT */
export default contrast;