Closed ianmackenzie closed 4 years ago
I don't think this really makes sense any more given the recent addition of Length.cssPixels
- Pixels.pixels
is still awkward but it may be possible to fix that by moving everything into one Quantity
module (#31).
I've never liked the
Pixels.pixels
andPixels.inPixels
function names - one solution would be to have aCss.Units
module (intended to be importedas Css
), something like:Then client code could write
I think
Css.pixels
is both more explicit (CSS pixels as opposed to physical pixels) and reads better thanPixels.pixels
, in addition to being shorter =)This would ideally be accompanied by a
Quantity.in_
function (#27), so you could writeinstead of needing a
Css.inPixels
function (what does "CSS in pixels" mean?).I think this could form a good pattern for similar custom modules in the future, like a
Game
module exposing aGame.Tiles
units type and aGame.tiles
function.Possible extensions:
Css.length
function that takes aLength
and converts it to aQuantity Float Pixels
using thenominalPixelDensity
Css.inches
,Css.millimeters
etc.Css.pixelsPerSecond
,Css.pixelsPerSecondSquared
etc.