mirror of
https://github.com/flarum/core.git
synced 2025-08-02 22:47:33 +02:00
chore: format js
This commit is contained in:
@@ -6,16 +6,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export default function isDark(hexcolor: String) {
|
export default function isDark(hexcolor: String) {
|
||||||
let hexnumbers = hexcolor.replace("#", "");
|
let hexnumbers = hexcolor.replace('#', '');
|
||||||
|
|
||||||
if (hexnumbers.length == 3) {
|
if (hexnumbers.length == 3) {
|
||||||
hexnumbers += hexnumbers;
|
hexnumbers += hexnumbers;
|
||||||
}
|
}
|
||||||
|
|
||||||
const r = parseInt(hexnumbers.substr(0,2),16);
|
const r = parseInt(hexnumbers.substr(0, 2), 16);
|
||||||
const g = parseInt(hexnumbers.substr(2,2),16);
|
const g = parseInt(hexnumbers.substr(2, 2), 16);
|
||||||
const b = parseInt(hexnumbers.substr(4,2),16);
|
const b = parseInt(hexnumbers.substr(4, 2), 16);
|
||||||
const yiq = ((r*299)+(g*587)+(b*114))/1000;
|
const yiq = (r * 299 + g * 587 + b * 114) / 1000;
|
||||||
|
|
||||||
return (yiq >= 128) ? false : true;
|
return yiq >= 128 ? false : true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user