Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duotone support. #4

Closed
Lattyware opened this issue Aug 8, 2019 · 2 comments
Closed

Duotone support. #4

Lattyware opened this issue Aug 8, 2019 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@Lattyware
Copy link
Owner

Lattyware commented Aug 8, 2019

Initial work in #1, but split out here as the implementation changes were bigger.

As of 47a4483, this is in and working (bumps to 4.0.0 as it requires a change to the shape of Icon to support multiple paths).

image

Here shown rendering in a modified version of elm-fontawesome-example.

duotone =
    exampleSection "Duotone"
        [ Html.div [ Icon.fa3x ]
            [ Duotone.camera |> Icon.viewIcon
            , Duotone.camera |> Icon.viewStyled [ Icon.swapOpacity ]
            , Duotone.fireAlt |> Icon.viewIcon
            , Duotone.fireAlt |> Icon.viewStyled [ Icon.swapOpacity ]
            , Duotone.busAlt |> Icon.viewIcon
            , Duotone.busAlt |> Icon.viewStyled [ Icon.swapOpacity ]
            ]
        , Html.div [ Icon.fa3x ] duotoneOpacity
        , Html.div [ Icon.fa3x ]
            [ Duotone.crow |> Icon.viewStyled [ HtmlA.attribute "style" "--fa-secondary-opacity: 1.0; --fa-primary-color: dodgerblue; --fa-secondary-color: gold;" ] ]
        ]


duotoneOpacity =
    [ 0.2, 0.4, 0.6, 0.8, 1 ] |> List.map (\o -> Duotone.busAlt |> Icon.viewStyled [ opacity "secondary" o ])


opacity path o =
    HtmlA.attribute "style" ("--fa-" ++ path ++ "-opacity: " ++ String.fromFloat o)

There are a couple of issues here. The core one is the lack of custom property support in Elm. The expected HtmlA.style "--fa-primary-opacity" "0.5", for example, doesn't work. This is tracked in this upstream issue. You can work around this, as shown, but this is very fragile and will override any other styles making it very hard to combine. Ideally we would expose helpers in the Styles module for this, but until we can do it properly it isn't worth it.

Second, as this is a pro-only feature, we can't actually give examples as we only have the free version publicly built, so pro users will have to try it out for themselves.

@Lattyware Lattyware added the enhancement New feature or request label Aug 8, 2019
@Lattyware Lattyware self-assigned this Aug 8, 2019
@Lattyware
Copy link
Owner Author

For now, I'm not going to bother releasing a new version of the library—pro users can build using master anyway, and free users gain nothing from this version. I'd also prefer to have the custom property issue fixed before releasing if possible.

@Lattyware
Copy link
Owner Author

As this is a pro feature, it is no longer supported due to a lack of support from FontAwesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant