Skip to content

Work with scoped themes based on CSS variables with light and dark modes.

License

Notifications You must be signed in to change notification settings

uncover-co/elm-theme-provider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

elm-theme-provider

This package is used for creating "themes" based on CSS variables and propagating them through your application. It also provides strategies to deal with dark mode easily.

You can pick one of the themes from elm-theme-spec or you can define your own like so:

lightTheme : Theme
lightTheme =
    ThemeProvider.fromList 
        [ ( "background", "white"
        , ( "accent", "blue" )
        ]


darkTheme : Theme
darkTheme =
    ThemeProvider.fromList 
        [ ( "background", "black"
        , ( "accent", "blue" )
        ]


main : Html msg
main =
    div []
        [ -- provide both light and dark themes globally
          -- SystemStrategy will use the user's system settings
          ThemeProvider.globalProviderWithDarkMode
            { light = lightTheme
            , dark = darkTheme
            , strategy = ThemeProvider.SystemStrategy
            }

        -- section using the default light or dark theme
        , section [] [ .. ]

        -- section using an scoped theme
        , ThemeProvider.provider specialTheme [] [ .. ]
        ]

About

Work with scoped themes based on CSS variables with light and dark modes.

Resources

License

Stars

Watchers

Forks

Packages

No packages published