-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed invisible label view in label constructor #5041
Conversation
/check |
❌ Some checks failed |
/check |
❌ Some checks failed |
/check |
✔️ All checks completed successfully |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job, bright labels are visible now 😃
const grayscale = (parseInt(r, 16) + parseInt(g, 16) + parseInt(b, 16)) / 3; | ||
if (grayscale - 128 >= 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about using something like HSL?
let [r, g, b] = [backgroundColor.slice(1, 3), backgroundColor.slice(3, 5), backgroundColor.slice(5, 7)];
r = parseInt(r, 16) / 255;
g = parseInt(g, 16) / 255;
b = parseInt(b, 16) / 255;
const CMax = Math.max(r, g, b);
const CMin = Math.min(r, g, b);
const lightness = (CMax + CMin) / 2;
if (lightness - 0.85 >= 0) {
textColor = '#000000';
}
Personally I liked first variant more.
Motivation and context
Related #5031
Before:
After:
How has this been tested?
Checklist
develop
branchcvat-core, cvat-data and cvat-ui)
License
Feel free to contact the maintainers if that's a concern.