6 ms·
Seems like something that could be calculated and baked server side
by pyrolistical 4y ago
Seems like something that could be calculated and baked server side
- madeofpalk 4y agoexcept the server doesn't know if the client prefers light or dark mode
- ok_dad 4y agoFor accessibility, it’s better to do this client side, so clients can adjust it themselves to be more contrasting or whatever.
- pyrolistical 4y agothat's cool. use both. calculate a good default contrast server side, use proposal to allow client side to override default
- sharlos201068 4y agoUnless it's a dynamic arbitrary colour (user-selected, overlaid on an image, etc.) then there's not much reason to be doing colour contrast calculations. Your site's design should just have well-chosen colours.
- anikom15 4y agoThe only reason this is a problem is because different monitors have different display characteristics compounded by arbitrary viewing environments. A client-side function can measure neither the response of the monitor nor the ambient light of the room, so this problem can never be solved in this manner.
- namibj 4y agoBoth of those are already APIs today in phones. And there's decent reason to not want to tell the server either.
- eyelidlessness 4y agoSo GP was relevant because that’s exactly what GitHub is doing: dynamically picking arbitrary colors and trying to put appropriately contrasting text on them.
- ilyt 4y agoBut you still need to pick contrasting colors manually ? This one isn't making new ones for you. CSS function doing "here is color A, here is color B, make one that is same hue as color B but contrasting" would be much more useful
- layer8 4y agoClients are free to provide a contrast dial independently of that. For example there’s a Font Contrast extension for Firefox.
- frosted-flakes 4y agoIf it's a static colour, sure. But if it's set by the user with a colour picker, that doesn't really work.