Accessibility First DevRel. I focus on ensuring content created, events held and company assets are as accessible as possible, for as many people as possible.
Coder | Dreamer | Blogger
Connect with me on LinkedIn @ www.linkedin.com/in/jamie-mcmanus-a103a967
When I'm not smashing keyboards and writing code, I am drinking Coffee and looking at the stars.
Accessibility First DevRel. I focus on ensuring content created, events held and company assets are as accessible as possible, for as many people as possible.
If you get a 220 luminosity result you are trying to add 100 to it and capping at 255. I think all you have done is swap your greater thans and less thans by mistake!
Also with the way you have done it you could actually just do
Less than 127, add 100. Greater than 127, remove 100. You will never go out of bounds so you donβt need the additional checks. (126+100 or 127 - 100, it will always be within 0 to 255.)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
See I like the concept, but (and I could be reading it wrong) - does this not start failing the closer a colour has to a luminance of 127?
Instead, perhaps you could do something where you try and make the luminance +100, if it goes over 255 then try - 100?
That way you should always get good contrast?
I can't believe I didn't notice that, thanks !
I have adjusted the code to add additional contrast.
I think you made another minor mistake ππ€£
If you get a 220 luminosity result you are trying to add 100 to it and capping at 255. I think all you have done is swap your greater thans and less thans by mistake!
Also with the way you have done it you could actually just do
Less than 127, add 100. Greater than 127, remove 100. You will never go out of bounds so you donβt need the additional checks. (126+100 or 127 - 100, it will always be within 0 to 255.)