Search
Converting Color Spaces in JavaScript
10.1.2019
A challenge I faced in building an image "emojifier" was that I needed to change the color spaces of values obtained using getImageData() from RGB to HSL. I used arrays of emojis arranged by brightness and saturation, and they were HSL-based for the best matches of average pixel colors with...
An Initial Implementation of clip-path: path();
24.12.2018
One thing that has long surprised (and saddened) me is that the clip-path property, as awesome as it is, only takes a few values. The circle() and ellipse() functions are nice, but hiding overflows and rounding with border-radius generally helps there already. Perhaps the most useful value...
DRY State Switching With CSS Variables: Fallbacks and Invalid Values
6.12.2018
This is the second post in a two-part series that looks into the way CSS variables can be used to make the code for complex layouts and interactions less difficult to write and a lot easier to maintain. The first installment walks through various use cases where this technique applies. This post...
DRY Switching with CSS Variables: The Difference of One Declaration
5.12.2018
This is the first post of a two-part series that looks into the way CSS variables can be used to make the code for complex layouts and interactions less difficult to write and a lot easier to maintain. This first installment walks through various use cases where this technique applies. The second...
Object.fromEntries
9.11.2018
The Object object has been buffed with useful methods over the past few years. Object.keys, Object.values, Object.freeze, and Object.assign all address frequently desired functionality. One of the new Object methods is fromEntries, which accepts a Map or map-like array nesting and converts it...
How to Get and Set CSS Variable Values with JavaScript
8.10.2018
CSS variables are a very welcome addition to the language, despite them being incredibly basic. Sure we could use SASS or stylus but languages should never count on developers relying on frameworks and toolkits to accomplish what we know we need. And just like every other part of a webpage,...
WDRL — Edition 234: Design Patterns, Tech Values, Feature Policy and CSS Grid in IE11
6.7.2018
Hey,
This week Andrea Giammarchi excited me with his article about a bloatless web. In that article he describes how we blindly use Babel as developers when we write JavaScript to be able to write modern ECMAScript. But we usually don’t realize that transpiling all our modern code in modern...
Animating Progress
30.4.2018
Jonathan Snook on the complexity of animating the <progress> element. If you’re unfamiliar, that’s the element that spits out a bar chart-like visual that indicates a position between two values:
This example has custom styles, but you get the point.
Jonathan's post shows off a method...
Finger-friendly numerical inputs with `inputmode`
30.4.2018
Forms are often a nightmare on mobile. We can make the process as pain-free as possible by reacting to context. Input fields that expect numerical values should have a numerical UI. Bringing up a number keyboard on small screens is easy on most platforms — just use a <input...
Destructuring and Function Arguments
3.4.2018
The JavaScript language has benefitted from some really awesome new features over the past few years, including arrow functions, the spread operator, and default function argument values. Even if your browser doesn’t yet support proposed JavaScript API syntax additions, you can use a tool...