StackExchange / Stacks

Stack Overflow’s Design System
https://stackoverflow.design
MIT License
602 stars 90 forks source link

fix(a11y): update code highlight colors to meet contrast requirement #1724

Closed dancormier closed 2 months ago

dancormier commented 2 months ago

Addresses:


This PR resolves outstanding contrast issues with code highlight colors. The changes should be subtle enough as to barely be noticeable.

[!NOTE] We could attempt to change many of these colors to use core Stacks colors, but I figure it's best to keep it simple for now in order to resolve A11Y issues and decide later if we want to make more sweeping changes here.

Color variable changes

variable name mode old color old contrast new color new contrast
--highlight-literal dark hsl(27, 85%, 61.5%) Lc 55 hsl(27, 95%, 65%) Lc 60
--highlight-namespace dark hsl(27, 85%, 61.5%) Lc 55 hsl(27, 95%, 65%) Lc 60
--highlight-symbol dark hsl(306, 43%, 69%) Lc 51 hsl(306, 50%, 75%) Lc 60
--highlight-variable light HC hsl(88, 100%, 19%) 6.8:1 hsl(88, 100%, 18%) 7.3:1
Screenshot comparison (dark mode) **Note**: The difference is in the orange (e.g.: `0.6em 0.7em`) and purple (e.g.: `border-radius`) text. ### Before ![image](https://github.com/StackExchange/Stacks/assets/647177/051c0699-e39b-4d1d-b496-e4f5a89b876e) ### After ![image](https://github.com/StackExchange/Stacks/assets/647177/28b85a56-11a5-4cb9-af49-ad7a564caeee)
Screenshot comparison (light HC mode) **Note**: The difference is in the green (e.g.: `apples`) text. ### Before ![image](https://github.com/StackExchange/Stacks/assets/647177/ecb7c7e2-f0ec-4da4-876b-9e7b8aab984e) ### After ![image](https://github.com/StackExchange/Stacks/assets/647177/c7cab8aa-cce5-4c8c-8ae5-541a2f42b264)

To test

netlify[bot] commented 2 months ago

Deploy Preview for stacks ready!

Name Link
Latest commit 90e2854748d679e642bac08d9dc24715164b0d05
Latest deploy log https://app.netlify.com/sites/stacks/deploys/66326cac46317e00084fcec7
Deploy Preview https://deploy-preview-1724--stacks.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.