Show: dhall-css-color v0.1.0

Hey again. After doing the dhall-webmanifest, it made me want something to express CSS colors which come up in a lot of other places.

To get some types around the appropriate representations, while also have some convenience is creation, I created dhall-css-color. It’s not fully complete, but I think it’s a point where I’d like to show and get some feedback.

Some of the biggest features ‘missing’ from Dhall to fully flesh this out are

  • Double math: with this I could have a way to convert from representations (most important in taking something that’s CSS4 compatible to CSS3.
  • Double/show + trim trailing .0: just makes things smaller
  • Bitmasking or at least a way to Natural -> Text as hexadecimal: I think we can agree this is not a great way to slice hexadecimal notation. JavaScript has Number.toString(radix). With bit masking, one can get out the channels from 0xffccee, but I keep the separate so that if block is smaller.
2 Likes

Might be worth extending the Haskell Dhall library with a showHex builtin? Then you could test drive it!

1 Like