unional / aurelia-logging-color

Colorful appender for aurelia-logging
MIT License
2 stars 3 forks source link

Improve colors #2

Closed unional closed 7 years ago

unional commented 7 years ago

Currently, some color combinations make the text hard to read. Need to optimize it a bit.

Here are some ideas:

yajurvendrasinh commented 7 years ago
unional commented 7 years ago

@yajurvendrasinh I like the contrast idea a lot. How can we generate the right color based on the background color?

i.e.:

function createContrastColor(/* background */ color: Color, contrast: number) {
  // ...
}
unional commented 7 years ago

Info about contrast ratio: https://www.w3.org/TR/WCAG/#contrast-ratiodef https://www.w3.org/TR/WCAG/#relativeluminancedef

And video on contrast ratio: https://youtu.be/LBmLspdAtxM thanks @yajurvendrasinh

srshah19 commented 7 years ago

Some great points added. One way to find the contrast color based on the background would be to calculate the luminance (L = 0.2126*R + 0.7152 * G + 0.0722 * B). If the luminance is lower than 200 (darker background, we make the text lighter). I will create a PR to demonstrate. We could also possibly calculate the contrast ratio of foreground/background based on the standards and generate text colors whose ratio is higher than 4.5:1.

unional commented 7 years ago

Closed by #4