Orasund / elm-ui-widgets

Collection of reusable views for elm-ui.
https://orasund.github.io/elm-ui-widgets/
BSD 3-Clause "New" or "Revised" License
85 stars 11 forks source link

Name Space Collision #26

Closed GaryBozek closed 3 years ago

GaryBozek commented 3 years ago

I was testing how to implement my own color palette and found a potential name collision. This may not have existed before the V 2.2.0 Commit.

The /Widget/Style/Material.elm module uses avh4/elm-color as the type in Palette. When I defined my own Palette to override in a module that already imported Color from elm-ui package (Element), it would not compile.

myDefaultPalette : Material.Palette
myDefaultPalette = 

    { primary    = rgb255  44  44  44       -- grey
    , secondary = .....
        : 
        : 

There are workarounds:

  1. Separate the elm-ui and elm-ui-widgets code into separate modules
  2. To use both elm-ui and elm-ui-widgets in the same module:
    • elm install avh4/elm-color
    • import Color as Avh4Color
    • use: { primary = Avh4Color.rgb255 44 44 44 -- grey

I point this out since this package explicitly targets users of elm-ui. If an existing code base utilizes Color from elm-ui package, there may be potential issues.

Orasund commented 3 years ago

Closed, as this is not an issue.

Use Color.rgb255 and Element.rgb255 respectively.

Color.Color should be the preferred over Element.Color, but as you can see there is no name space collision.

For more info checkout the corresponding issue over at Elm-Ui