Moving Color to evancz/graphics

236 views
Skip to first unread message

Nick H

unread,
Sep 29, 2016, 4:16:30 PM9/29/16
to elm-d...@googlegroups.com
Hi everybody,

Since 0.18 is going to involve some module juggling in core, I thought this would be a good time to bring this up.

This is a follow-up to an elm-discuss thread from last month. Robin argued that the Color module should not be in elm-lang/core. I agreed and suggested that it be moved to evancz/graphics.

For me the strongest indicator that Color doesn't belong in core is to look at who depends on it. Neither of the UI-related elm-lang packages (html, svg) use it. elm-css and elm-mdl both define their own color types.

The only library that operates well with Color is evancz/graphics. Furthermore, it is the only one that can use the entire thing. The Gradient type is opaque, so it's impossible for anyone but evancz/graphics to use it.

I hate to suggest "one more thing" to add to the release, but it feels like low-hanging fruit. I'm sure there is a reason Color stayed behind when Graphics was extracted. One way or the other, it should be easy to decide. And if it makes sense to move it, the lack of dependencies means the change would be easy to implement.

Thanks for humoring me,

~Nick

Nick H

unread,
Sep 29, 2016, 4:17:38 PM9/29/16
to elm-d...@googlegroups.com
P.S. If this sounds like a good idea, I am happy to do the work.

Matthew Griffith

unread,
Sep 29, 2016, 9:55:38 PM9/29/16
to Elm Discuss

elm-style-animation accepts the Color types from core as arguments for color property animations. So does my color mixing library (though who knows how many people use that :)  I'm working on another library that utilizes it as well.

Having a centralized idea of color seems like a pretty basic and useful thing to me, even if two prominent libraries don't use it directly.  Moving it to evancz/graphics means I have to either make my users depend on evancz/graphics(which doesn't make a ton of sense as they're probably using the html/svg libraries), or it means that every library that wants to work with color has to export their own type, which seems a bit much as well.

So, I guess I'm happy where it is:)

-Matt

Janis Voigtländer

unread,
Sep 30, 2016, 1:23:11 AM9/30/16
to elm-d...@googlegroups.com

Given this:

The Gradient type is opaque, so it’s impossible for anyone but evancz/graphics to use it.

How about moving the Gradient type and functions related to it to evancz/elm-graphics?

Matthew Griffith

unread,
Sep 30, 2016, 7:33:35 AM9/30/16
to Elm Discuss

Yeah, I'd be fine with that.  Not being able to read out gradient values means I can't really use it.

OvermindDL1

unread,
Sep 30, 2016, 10:13:25 AM9/30/16
to Elm Discuss
Why is Gradient not public so other libraries can use it anyway?

Zinggi

unread,
Sep 30, 2016, 3:05:03 PM9/30/16
to Elm Discuss
As Matthew already said, I think it would be a bad idea to put Color in elm-graphics.

Color is a general concept and very useful also outside elm-graphics.
In my 2d game library I'm also making use of Color for drawing colored rectangles.
I wouldn't want to add a dependency on elm-graphics!

I think it would make sense to either leave it in core or
to move it in its own module, e.g. probably to elm-community/color

Plus gradient should either be exposed or moved to elm-graphics. 

Richard Feldman

unread,
Sep 30, 2016, 9:10:37 PM9/30/16
to Elm Discuss
I wrote up an issue for elm-css proposing switching to use it.

The issue summarizes the pros and cons, and gives an idea of why I didn't use it in the first place. :)
Reply all
Reply to author
Forward
0 new messages