Skip to content

Instantly share code, notes, and snippets.

View sumitasok's full-sized avatar

Sumit. M. Asok sumitasok

View GitHub Profile

An Anonymous Pen

Compass's color contrast mixin seems to favor dark text because it depends on the HSLA lightness of a color. Selecting between light and dark text based on a lightness threshold is not enough to make proper color contrast decisions.

W3C discusses an algorithm to ensure a color is well contrasted against a background. http://www.w3.org/WAI/ER/WD-AERT/#color-contrast

I've used the algorithm here for finding the difference between a given background color, and specified light, and dark values. The mixin will use the light or dark value that has a greater difference form the background color.

I left the compass "contrasted" mixin commented in the code, un comment to see the difference between contrast choices.

@sumitasok
sumitasok / Dockerfile
Created June 16, 2019 07:08 — forked from perrygeo/Dockerfile
Minimal debian image with Python 3.6 and geo python tools
FROM python:3.6-slim-stretch
ADD requirements.txt /tmp/requirements.txt
RUN apt-get update && \
apt-get install -y \
build-essential \
make \
gcc \
locales \