Skip to content

Commit f09756f

Browse files
authored
Fix: Text color selection for given background now takes into account human perception. (#820)
1 parent 07b901a commit f09756f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export function computeColor(color: string): string {
112112

113113
export function computeTextColor(backgroundColor: string): string {
114114
const colorObj = new TinyColor(backgroundColor);
115-
if (colorObj.isValid && colorObj.getLuminance() > 0.5) {
115+
if (colorObj.isValid && colorObj.isLight()) {
116116
return '#000'; // bright colors - black font
117117
} else {
118118
return '#fff'; // dark colors - white font

0 commit comments

Comments
 (0)